@axiom-lattice/core 2.1.72 → 2.1.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +106 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +106 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19070,10 +19070,105 @@ Use this when the task follows a standard BPO (Business Process Orchestration) p
|
|
|
19070
19070
|
|
|
19071
19071
|
**Business rule \u2014 Draft-then-confirm pattern:** When a workflow creates business objects that require human approval (e.g., draft orders in SAP B1, purchase requisitions, expense reports), the design MUST include a confirmation step AFTER the creation step. The create step must complete successfully before the confirm step runs. The flow is always: **Create draft \u2192 User confirms \u2192 Finalize**. Reason: systems like SAP B1 only expose drafts to users after they are created \u2014 the user cannot see or approve something that doesn't exist yet. The confirm step MUST use the \`ask_user_to_clarify\` middleware.
|
|
19072
19072
|
|
|
19073
|
+
**Business pattern \u2014 SAP B1 Draft SO Creation:** When designing a sub-agent responsible for creating draft Sales Orders in SAP B1, embed the following standards into its system prompt. These ensure consistent data construction, API usage, and user presentation:
|
|
19074
|
+
|
|
19075
|
+
**Step 1: Construct SO Data Structure**
|
|
19076
|
+
Build the JSON payload. For each DocumentLines item:
|
|
19077
|
+
- Include \`WarehouseCode\` ONLY if sku.json provides a value; if missing or empty, OMIT the field entirely
|
|
19078
|
+
- Generate \`Comments\` dynamically based on context (customer name, PO reference, special instructions)
|
|
19079
|
+
|
|
19080
|
+
\`\`\`json
|
|
19081
|
+
{
|
|
19082
|
+
"DocObjectCode": "17",
|
|
19083
|
+
"DocType": "dDocument_Items",
|
|
19084
|
+
"CardCode": "C001",
|
|
19085
|
+
"DocDate": "current date",
|
|
19086
|
+
"DocDueDate": "delivery date",
|
|
19087
|
+
"TaxDate": "current date",
|
|
19088
|
+
"U_YWLX": "Modern Trade",
|
|
19089
|
+
"Comments": "SO for Kaimay Retail - PO ref: PO-2024-001234",
|
|
19090
|
+
"DocumentLines": [
|
|
19091
|
+
{
|
|
19092
|
+
"ItemCode": "SKU001",
|
|
19093
|
+
"Quantity": 240,
|
|
19094
|
+
"UnitPrice": 15.84
|
|
19095
|
+
}
|
|
19096
|
+
]
|
|
19097
|
+
}
|
|
19098
|
+
\`\`\`
|
|
19099
|
+
|
|
19100
|
+
Field mapping rules:
|
|
19101
|
+
| SAP Field | Data Source |
|
|
19102
|
+
|-----------|-------------|
|
|
19103
|
+
| CardCode | customer.json \u2192 CardCode |
|
|
19104
|
+
| DocDate | Current date (yyyy-MM-dd) |
|
|
19105
|
+
| DocDueDate | extracted.json \u2192 delivery_date |
|
|
19106
|
+
| TaxDate | Current date (yyyy-MM-dd) |
|
|
19107
|
+
| U_YWLX | customer.json \u2192 SalesType |
|
|
19108
|
+
| ItemCode | sku.json \u2192 ItemCode |
|
|
19109
|
+
| Quantity | extracted.json \u2192 Quantity |
|
|
19110
|
+
| WarehouseCode | sku.json \u2192 WarehouseCode (OMIT if missing/empty) |
|
|
19111
|
+
| UnitPrice | price.json \u2192 UnitPrice |
|
|
19112
|
+
| Comments | AI-generated based on customer name, PO reference, and context |
|
|
19113
|
+
|
|
19114
|
+
**Step 2: Call SAP API to Create Draft (MUST EXECUTE)**
|
|
19115
|
+
Use the \`sap_api_call\` tool with EXACTLY these parameters:
|
|
19116
|
+
- **Method**: POST
|
|
19117
|
+
- **Endpoint**: \`Drafts\` (ONLY allowed endpoint; do NOT call SalesOrders or any other endpoint)
|
|
19118
|
+
- **Body**: The JSON constructed in Step 1
|
|
19119
|
+
|
|
19120
|
+
CRITICAL: You MUST call sap_api_call BEFORE proceeding to Step 3. This step is NOT optional.
|
|
19121
|
+
|
|
19122
|
+
If the API call fails:
|
|
19123
|
+
- Log the error details
|
|
19124
|
+
- STOP the process
|
|
19125
|
+
- Report the failure to the user with the error message
|
|
19126
|
+
- Do NOT proceed to Step 3
|
|
19127
|
+
|
|
19128
|
+
**Step 3: Present Draft for User Review (MUST EXECUTE AFTER Step 2)**
|
|
19129
|
+
ONLY after the SAP API call in Step 2 succeeds, use the \`ask_user_to_clarify\` tool to present the complete SO summary.
|
|
19130
|
+
|
|
19131
|
+
Message format (STRICT \u2014 no emoji, no summary, field names match Service Layer):
|
|
19132
|
+
|
|
19133
|
+
=== Sales Order Draft ===
|
|
19134
|
+
|
|
19135
|
+
DocEntry: {DocEntry}
|
|
19136
|
+
DocNum: {DocNum}
|
|
19137
|
+
DocDate: {DocDate}
|
|
19138
|
+
DocDueDate: {DocDueDate}
|
|
19139
|
+
CardCode: {CardCode}
|
|
19140
|
+
CardName: {CardName}
|
|
19141
|
+
U_YWLX: {SalesType}
|
|
19142
|
+
Comments: {Comments}
|
|
19143
|
+
|
|
19144
|
+
DocumentLines:
|
|
19145
|
+
LineNum | ItemCode | Quantity | WarehouseCode | UnitPrice | LineTotal
|
|
19146
|
+
0 | {ItemCode} | {Quantity} | {WarehouseCode} | {UnitPrice} | {LineTotal}
|
|
19147
|
+
1 | {ItemCode} | {Quantity} | {WarehouseCode} | {UnitPrice} | {LineTotal}
|
|
19148
|
+
...
|
|
19149
|
+
|
|
19150
|
+
DocTotal: {DocTotal}
|
|
19151
|
+
|
|
19152
|
+
Warnings:
|
|
19153
|
+
- {warning1}
|
|
19154
|
+
- {warning2}
|
|
19155
|
+
|
|
19156
|
+
Options:
|
|
19157
|
+
[Confirm generating draft]
|
|
19158
|
+
[Cancel, do not generate]
|
|
19159
|
+
|
|
19160
|
+
**Data sharing pattern \u2014 File-based handoff:** Every sub-agent in the pipeline MUST persist its work results as files under a shared project directory, never rely on in-memory data passing between steps. Deep agents have built-in file capabilities, so no middleware is needed.
|
|
19161
|
+
|
|
19162
|
+
Rules:
|
|
19163
|
+
1. The **orchestrator** generates a unique project ID at the start (e.g., timestamp-based) and passes it to each sub-agent in the task context
|
|
19164
|
+
2. Each sub-agent reads input from \`/project/{project-id}/\` and writes output files into the same directory
|
|
19165
|
+
3. Establish clear file naming conventions so downstream steps know exactly which files to read (e.g., \`extracted.json\`, \`sku.json\`, \`customer.json\`, \`so_draft.json\`)
|
|
19166
|
+
4. The orchestrator's system prompt MUST specify for each edge: which files the target sub-agent should read and which files it should produce
|
|
19167
|
+
|
|
19073
19168
|
**Step 2: Topology design.** Design the agent topology and use \`show_widget\` to render an interactive diagram showing the flow: Orchestrator \u2192 Stage 1 \u2192 Stage 2 \u2192 ... \u2192 Output. Each edge should be labeled with its business purpose.
|
|
19074
19169
|
|
|
19075
19170
|
**Step 3: Design each sub-agent** as a **deep_agent** type (one at a time). For each:
|
|
19076
|
-
- Responsibility, system prompt, middleware, input/output contract
|
|
19171
|
+
- Responsibility, system prompt, middleware, file input/output contract (which files from \`/project/{project-id}/\` it reads, which files it writes)
|
|
19077
19172
|
- Deep agents have built-in file capabilities (ls, read, write, edit, glob, grep), so do NOT add filesystem middleware.
|
|
19078
19173
|
- **Ask for confirmation before moving to the next sub-agent.**
|
|
19079
19174
|
|
|
@@ -19092,15 +19187,15 @@ Use this when the task follows a standard BPO (Business Process Orchestration) p
|
|
|
19092
19187
|
| Section | Content |
|
|
19093
19188
|
|---------|---------|
|
|
19094
19189
|
| **Overview** | One-sentence summary of the workflow's purpose and business value |
|
|
19095
|
-
| **Steps** | Numbered list of each stage in the pipeline. For each step: which sub-agent handles it, what it does, what tools it uses, and what it
|
|
19096
|
-
| **Data Flow** | How data moves between steps
|
|
19190
|
+
| **Steps** | Numbered list of each stage in the pipeline. For each step: which sub-agent handles it, what it does, what tools it uses, what files it reads from \`/project/{project-id}/\`, and what files it writes. |
|
|
19191
|
+
| **Data Flow** | How data moves between steps via files under \`/project/{project-id}/\`. For each step: which files it reads as input and which files it writes as output. |
|
|
19097
19192
|
| **Logic & Conditions** | Any conditional branching, decision points, retry logic, or exception handling. When does the workflow take path A vs path B? What happens on failure? |
|
|
19098
19193
|
| **Tools Used** | Summary table or list of all tools used across sub-agents, grouped by sub-agent |
|
|
19099
19194
|
| **Expected Input** | What input does the workflow expect from the user? (format, examples) |
|
|
19100
19195
|
| **Expected Output** | What does the workflow produce at the end? (format, examples) |
|
|
19101
19196
|
|
|
19102
19197
|
**Formatting rules:**
|
|
19103
|
-
|
|
19198
|
+
- Write in **English**
|
|
19104
19199
|
- Use **Markdown** for formatting (headings, lists, tables, code blocks)
|
|
19105
19200
|
- Be detailed but concise \u2014 each section should be 1-5 lines
|
|
19106
19201
|
- Avoid placeholder text like "TODO" or "TBD"
|
|
@@ -19112,13 +19207,14 @@ Use this when the task follows a standard BPO (Business Process Orchestration) p
|
|
|
19112
19207
|
\u672C\u5DE5\u4F5C\u6D41\u81EA\u52A8\u4ECE\u591A\u4E2A\u6570\u636E\u6E90\u91C7\u96C6\u7ADE\u54C1\u4EF7\u683C\uFF0C\u751F\u6210\u5BF9\u6BD4\u5206\u6790\u62A5\u544A\u5E76\u63A8\u9001\u901A\u77E5\u3002
|
|
19113
19208
|
|
|
19114
19209
|
## Steps
|
|
19115
|
-
|
|
19116
|
-
|
|
19117
|
-
|
|
19118
|
-
|
|
19210
|
+
1. **\u6570\u636E\u91C7\u96C6 (data-collector)** \u2014 \u4F7F\u7528 browser \u5DE5\u5177\u722C\u53D6\u6307\u5B9AURL\u7684\u7ADE\u54C1\u4EF7\u683C\u6570\u636E\uFF0C\u8C03\u7528 metrics API \u62C9\u53D6\u5386\u53F2\u4EF7\u683C\u3002\u8F93\u51FA \u2192 \`raw_prices.json\`
|
|
19211
|
+
2. **\u6570\u636E\u6E05\u6D17 (data-cleaner)** \u2014 \u8BFB\u53D6 \`raw_prices.json\`\uFF0C\u4F7F\u7528 code_eval \u6267\u884C Python \u811A\u672C\u6E05\u6D17\u5F02\u5E38\u503C\u548C\u7F3A\u5931\u503C\uFF0C\u7EDF\u4E00\u8D27\u5E01\u5355\u4F4D\u3002\u8F93\u51FA \u2192 \`cleaned_prices.json\`
|
|
19212
|
+
3. **\u62A5\u544A\u751F\u6210 (report-generator)** \u2014 \u8BFB\u53D6 \`cleaned_prices.json\` \u548C\u6A21\u677F\u6587\u4EF6\uFF0Ccode_eval \u8BA1\u7B97\u6DA8\u8DCC\u5E45\u548C\u8D8B\u52BF\uFF0C\u751F\u6210 Markdown \u5BF9\u6BD4\u62A5\u544A\u3002\u8F93\u51FA \u2192 \`report.md\`
|
|
19213
|
+
4. **\u901A\u77E5\u63A8\u9001 (notifier)** \u2014 \u8BFB\u53D6 \`report.md\`\uFF0C\u8C03\u7528 scheduler \u5B89\u6392\u5B9A\u65F6\u53D1\u9001\uFF0C\u4F7F\u7528 ask_user_to_clarify \u8BF7\u6C42\u53D1\u9001\u786E\u8BA4\u3002\u8F93\u51FA\u53D1\u9001\u7ED3\u679C\u3002
|
|
19119
19214
|
|
|
19120
19215
|
## Data Flow
|
|
19121
|
-
|
|
19216
|
+
All data is shared via files under \`/project/{project-id}/\`:
|
|
19217
|
+
\`\u7528\u6237\u8F93\u5165\` \u2192 data-collector writes \`raw_prices.json\` \u2192 data-cleaner reads \`raw_prices.json\`, writes \`cleaned_prices.json\` \u2192 report-generator reads \`cleaned_prices.json\`, writes \`report.md\` \u2192 notifier reads \`report.md\`, pushes
|
|
19122
19218
|
|
|
19123
19219
|
## Logic & Conditions
|
|
19124
19220
|
- data-collector \u722C\u53D6\u5931\u8D25\u65F6\u91CD\u8BD5\u6700\u591A3\u6B21\uFF0C\u95F4\u969430\u79D2
|
|
@@ -19279,7 +19375,7 @@ Creates a PROCESSING agent with a business-defined workflow topology. Sub-agents
|
|
|
19279
19375
|
\`\`\`typescript
|
|
19280
19376
|
{
|
|
19281
19377
|
name: string, // Required. Display name for the orchestrator
|
|
19282
|
-
description?: string, // Required for good UX. Comprehensive workflow spec in Markdown (
|
|
19378
|
+
description?: string, // Required for good UX. Comprehensive workflow spec in Markdown (English). Must cover: Overview, Steps (with tools per step), Data Flow, Logic & Conditions, Tools Used, Expected Input, Expected Output. This is the single source of truth displayed in the automation view info popover.
|
|
19283
19379
|
prompt: string, // Required. System prompt \u2014 how to route through the topology
|
|
19284
19380
|
edges: [{ // Required. At least 1 edge defining the serial workflow chain
|
|
19285
19381
|
from: string, // Source agent ID. First edge: use orchestrator name as placeholder (tool auto-replaces). Subsequent edges: previous sub-agent ID
|