[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-1506":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":16,"starSnapshotCount":16,"syncStatus":30,"lastSyncTime":31,"discoverSource":32},1506,"agentscript","salesforce\u002Fagentscript","salesforce","An open, schema-driven language for configuring agent orchestration systems","",null,"TypeScript",244,45,8,4,0,5,7,21,15,4.99,"Apache License 2.0",false,"main",true,[],"2026-06-12 02:00:28","# Agent Script\n\n\u003C!-- Badges go here once repo is public -->\n\nAgent Script is an open agent specification language. It allows you to configure agents\nwith a common set of building blocks. It was developed for agentforce, but is meant to apply towards agents in general.\n\n## Overview\n\nThis repository contains libraries used for the following:\n\n1. Parsing + linting agentscript (base, agentforce, agentfabric dialects)\n2. Compiling agentforce dialect\n3. UIs + LSP tooling for agentscript\n\nWe provide this repository for developers to peruse\u002Fcontribute, agents to peruse\u002Fcontribute, agent builders to gain a deeper understanding of how agent script works.\n\nFor a formal language specification, see [SPEC.md](SPEC.md).\n\n### Why Agent Script\n\nAgent Script allows you to define an agent as a single file with custom syntax for storing state,\nspecifying execution flow, string templating, and defining deterministic hooks for agent control.\n\nAt salesforce, agent script integrates with the agent builder, as well as a variety of developer tools that enable management of the agent development lifecycle.\n\n### Determinism versus Autonomy\n\nAgent Script does not prescribe how much control you take. The language gives you the tools — how you use them is up to you.\n\nAt one end, you can write highly deterministic agents: use `before_reasoning` to gate transitions, `if`\u002F`else` to focus the LLM's instructions, and `set` to drive state explicitly. At the other end, you can write a single `reasoning.instructions` block and let the LLM reason freely. Most agents sit somewhere in between.\n\nThe key design principle is that execution is decoupled from specification. Agent Script describes *what* the agent is — its state, its available actions, its instructions — not *how* the runtime executes it. This means the same script can run on increasingly capable runtimes without changing a line of code. You're specifying the agent, not implementing it.\n\nIn this sense Agent Script follows the same pattern as other industry-standard declarative approaches: hooks, lifecycle events, data + procedures. More procedures means more determinism. Fewer procedures means more autonomy. The language doesn't take sides.\n\n## Quick Start\n\n### Prerequisites\n\nNode.js >= 20 and pnpm >= 8\n\n### Installation\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fsalesforce\u002Fagentscript.git\ncd agentscript\npnpm install\npnpm build\n```\n\n### Run the UI\n\n```bash\npnpm ui:dev\n```\n\nOpens the AgentScript playground at `http:\u002F\u002Flocalhost:27002`.\n\n### Use as a Library\n\n```bash\npnpm add @agentscript\u002Fagentforce\n```\n\n```typescript\nimport { parse } from '@agentscript\u002Fagentforce';\n\nconst doc = parse(`\nsystem:\n    instructions: \"You are a helpful agent.\"\n\ntopic billing:\n    description: \"Handle billing inquiries\"\n`);\n\nconsole.log(doc.hasErrors);   \u002F\u002F false\nconsole.log(doc.diagnostics); \u002F\u002F []\nconsole.log(doc.emit());      \u002F\u002F formatted source\n```\n\n## Syntax\u002FStructure Overview\n\nAgent Script is block-based. Everything is a block, and blocks compose to form an agent.\n\nBlocks fall into two categories: **configuration** (`config`, `system`) which set up the agent's identity and behavior, and **execution** (`topic`, `start_agent`) which define how the agent runs. The language is indentation-sensitive — like Python or YAML, indentation determines scope. Execution blocks have _implied_ execution -- i.e. determined by the runtime, meaning the simple ReAct loop is implemented behind the scenes and not within the script itself.\n\n**Keys and values** follow a simple pattern: keys are unquoted, values are introduced by `:`. Values can be any of the standard scalar types (string, number, boolean), a list, or a nested block. Together they form a full dictionary structure:\n\n```\nconfig:\n    agent_name: \"Support Bot\"\n    default_locale: \"en_US\"\n\nvariables:\n    case_id: mutable string = \"\"\n        description: \"The current support case ID\"\n    is_verified: mutable boolean = False\n```\n\n**Templates** use `|` for multiline strings:\n\n```\nsystem:\n    instructions: |\n        You are a helpful support agent.\n        Always verify the customer before discussing account details.\n```\n\n**Procedures** represent executable logic attached to a block. They can be explicitly introduced with `->`, but the parser auto-detects procedure context from the schema — so `->` is often optional. Parameters are currently implicit — derived from context rather than declared explicitly. Within a procedure that returns a string, `|` appends to the output:\n\n```\nreasoning:\n    instructions: ->\n        | Greet the user and ask for their case ID.\n        if @variables.is_verified:\n            | You may discuss account details.\n        | Always be concise and professional.\n```\n\n**Expressions** follow Python-like syntax with a fixed set of builtins. **Namespace lookups** use `@` — `@variables.case_id`, `@actions.lookup_case`, `@subagent.billing`.\n\n**Special procedural syntax** within execution blocks:\n\n- `set` — assigns a variable\n- `run` — invokes an action\n- `with` — assigns input parameters to an action\n- any block following a `with` clause denotes a **callback** — code that runs after the action returns\n\n```\nbefore_reasoning:\n    run @actions.verify_customer\n        with email=@variables.user_email\n        set @variables.is_verified = @outputs.verified\n        set @variables.case_id = @outputs.case_id\n\nafter_reasoning:\n    if not @variables.is_verified:\n        transition to @subagent.identity_verification\n```\n\nEach block has a **schema** defined by its dialect. A **dialect** is a collection of block types and their schemas — it defines what blocks are valid, what fields they accept, and what types those fields can be.\n\n## Architecture\n\n```\n┌─────────────────────────────────────────────────────────────────────┐\n│  UI Playground                                                       │\n│  Monaco editor · graph view · builder                               │\n├─────────────────────────────────────────────────────────────────────┤\n│  Editor Integrations                                                 │\n│  vscode · monaco                                                     │\n├─────────────────────────────────────────────────────────────────────┤\n│  LSP Layer                                                           │\n│  lsp (core) · lsp-server (Node.js) · lsp-browser (Worker)           │\n├─────────────────────────────────────────────────────────────────────┤\n│  Lint Passes                                                         │\n│  DAG of passes registered per-dialect                               │\n├─────────────────────────────────────────────────────────────────────┤\n│  Compiler                                                            │\n│  AST → Salesforce runtime specification                             │\n├─────────────────────────────────────────────────────────────────────┤\n│  Dialect Layer                                                       │\n│  agentscript (base) · agentforce · agentfabric                      │\n│  each extends the base schema with blocks, fields, and lint rules   │\n├─────────────────────────────────────────────────────────────────────┤\n│  Schema                                                              │\n│  TypeScript-defined block\u002Ffield schema — base + dialect extensions  │\n├─────────────────────────────────────────────────────────────────────┤\n│  Parsers                                                             │\n│  parser-javascript  (TypeScript, error-tolerant, CST output)        │\n│  parser-tree-sitter (C\u002FWASM, declarative, source-of-truth grammar)  │\n└─────────────────────────────────────────────────────────────────────┘\n```\n\n## Repository Overview\n\n### Foundation Layer\n\n| Package | Description |\n| --- | --- |\n| [`@agentscript\u002Ftypes`](packages\u002Ftypes\u002F) | Shared types (`SyntaxNode`, `Diagnostic`, `Range`, etc.) used across all packages. Zero dependencies. |\n| [`@agentscript\u002Fparser-tree-sitter`](packages\u002Fparser-tree-sitter\u002F) | Tree-sitter grammar and C parser. Generates Node.js native bindings and WASM for browser use. Zero internal dependencies. Must rebuild after grammar changes. |\n| [`@agentscript\u002Fparser-javascript`](packages\u002Fparser-javascript\u002F) | Hand-written TypeScript parser. Error-tolerant recursive descent with Pratt expression parsing and CST output. Pure JS — no native dependencies. |\n| [`@agentscript\u002Fparser`](packages\u002Fparser\u002F) | Parser abstraction layer. Resolves to `parser-javascript` by default; swap to `parser-tree-sitter` via conditional exports. |\n\n### Core Layer\n\n| Package | Description |\n| --- | --- |\n| [`@agentscript\u002Flanguage`](packages\u002Flanguage\u002F) | Language infrastructure and analysis engine. Provides AST types, scope\u002Fsymbol resolution, linting framework (18+ passes), and the Language Service API. |\n\n### Dialect Layer\n\n| Package | Description |\n| --- | --- |\n| [`@agentscript\u002Fagentscript-dialect`](dialect\u002Fagentscript\u002F) | Base dialect — core language schema and lint rules. |\n| [`@agentscript\u002Fagentforce-dialect`](dialect\u002Fagentforce\u002F) | Extends AgentScript with Salesforce Agentforce-specific blocks, fields, and compilation. |\n| [`@agentscript\u002Fagentfabric-dialect`](dialect\u002Fagentfabric\u002F) | AgentFabric dialect — alternative schema, lint rules, and compiler. |\n\n### Compiler\n\n| Package | Description |\n| --- | --- |\n| [`@agentscript\u002Fcompiler`](packages\u002Fcompiler\u002F) | Transforms parsed AgentScript AST into a Salesforce runtime specification with source-map support. |\n\n### SDK\n\n| Package | Description |\n| --- | --- |\n| [`@agentscript\u002Fagentforce`](packages\u002Fagentforce\u002F) | Batteries-included SDK. Combines parser, language, compiler, and dialects into a single import. Provides `parse()`, `Document` (with mutation\u002Fundo\u002Fredo), `parseComponent()`, `emitComponent()`, and `compileSource()`. Works in Node.js and browsers. |\n\n### LSP Layer\n\n| Package | Description |\n| --- | --- |\n| [`@agentscript\u002Flsp`](packages\u002Flsp\u002F) | Dialect-agnostic LSP core. All providers (diagnostics, hover, completions, definition, references, rename, symbols, code actions, semantic tokens) live here. Parser and dialects are injected via config. |\n| [`@agentscript\u002Flsp-server`](packages\u002Flsp-server\u002F) | Node.js LSP server. Thin stdio\u002FIPC wrapper over `@agentscript\u002Flsp`. Ships the `agentscript-lsp` CLI. |\n| [`@agentscript\u002Flsp-browser`](packages\u002Flsp-browser\u002F) | Browser LSP server. Runs in a Web Worker with the TypeScript parser. Single-bundle output. |\n\n### Editor Integrations\n\n| Package | Description |\n| --- | --- |\n| [`@agentscript\u002Fvscode`](packages\u002Fvscode\u002F) | VS Code extension — syntax highlighting, diagnostics, completions, go-to-definition, rename, and more for `.agent` files. |\n| [`@agentscript\u002Fmonaco`](packages\u002Fmonaco\u002F) | Monaco Editor integration — language registration, syntax highlighting, hover, and schema resolution. |\n\n### UI Playground\n\nA browser-based playground for working with Agent Script, backed by the full LSP. Includes:\n\n- **Monaco editor** — same editing experience as VS Code: diagnostics, completions, hover\n- **Graph view** — visualize the agent's topic\u002Fsubagent flow as a node graph\n- **CST\u002FAST explorer** — inspect the parse tree and compiled output in real time\n- **Multiple dialects** — switch between agentscript, agentforce, and agentfabric\n- **Example scripts** — preloaded examples to get started quickly\n\nRun locally with `pnpm ui:dev`. Contributions welcome.\n\n## Development\n\n```bash\npnpm build          # build all packages (via Turbo)\npnpm test           # run all tests\npnpm lint           # lint all packages\npnpm typecheck      # type-check all packages\npnpm format         # format with Prettier\npnpm dev            # watch mode for all packages\npnpm docs:dev       # run the docs site locally\npnpm ui:dev         # run the UI playground locally\n```\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for the contribution checklist and how to submit a pull request. You'll need to sign the [Salesforce CLA](https:\u002F\u002Fcla.salesforce.com\u002Fsign-cla) before your PR can be merged.\n\n## Questions\n\nOpen a [GitHub issue](https:\u002F\u002Fgithub.com\u002Fsalesforce\u002Fagentscript\u002Fissues\u002Fnew) for bugs, features, or questions.\n\n## Open Source Approach & Limitations\n\nWe're open sourcing the Agent Script specification, toolchain, and developer tools — the parser, linter, compiler, LSP, editor integrations, and UI. These are genuinely open and we welcome contributions to all of them.\n\nWhat we're not open sourcing (yet) is the runtime. Agent Script compiles to a Salesforce-internal specification format that executes on Salesforce infrastructure. That means you can parse, lint, compile, and build tooling around Agent Script, but running agents requires Salesforce's runtime environment.\n\nAs a result, we're not accepting changes to the language spec for now. The spec needs to stay in sync with the runtime, and until we have a path to open sourcing the runtime, unilateral spec changes would create a split we can't support.\n\nWhat's genuinely open:\n- the parser, linter, LSP, and all developer tooling\n- bug fixes across any of the above\n- editor integrations (VS Code, Monaco)\n- the UI playground\n- documentation and the formal spec\n\nWe want to be straightforward about this tradeoff. More will open up over time.\n\n## License\n\nApache 2.0 — see [LICENSE.txt](LICENSE.txt) for the full text.\n","Agent Script 是一种开放的、基于模式的语言，用于配置代理编排系统。它支持通过自定义语法在一个文件中定义代理的状态存储、执行流程、字符串模板以及确定性控制钩子等功能。该项目采用 TypeScript 编写，提供了解析、校验（包括 base, agentforce, agentfabric 方言）、编译 agentforce 方言的能力，并配备了 UI 和 LSP 工具以辅助开发。Agent Script 适合于需要灵活控制代理行为的应用场景，如在 Salesforce 中与代理构建器集成或是在其他要求代理具有不同程度自主性和确定性的环境中使用。其设计原则是将执行逻辑与规范分离，使得相同的脚本可以在不同能力级别的运行时上执行而无需修改代码，从而为开发者提供了一个强大的工具来平衡代理的自动化程度和可控性。",2,"2026-06-11 02:44:22","CREATED_QUERY"]