@granular-software/sdk 0.4.24 → 0.4.26
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/agent-evals.d.mts +1 -1
- package/dist/agent-evals.d.ts +1 -1
- package/dist/agent-evals.js +161 -38
- package/dist/agent-evals.js.map +1 -1
- package/dist/agent-evals.mjs +161 -38
- package/dist/agent-evals.mjs.map +1 -1
- package/dist/agent-harness.d.mts +1 -1
- package/dist/agent-harness.d.ts +1 -1
- package/dist/agent-harness.js +22 -11
- package/dist/agent-harness.js.map +1 -1
- package/dist/agent-harness.mjs +22 -11
- package/dist/agent-harness.mjs.map +1 -1
- package/dist/cli/index.js +97 -8
- package/dist/{client-CQFKsCTd.d.mts → client-Zoo8YITZ.d.mts} +39 -1
- package/dist/{client-CQFKsCTd.d.ts → client-Zoo8YITZ.d.ts} +39 -1
- package/dist/index.d.mts +11 -4
- package/dist/index.d.ts +11 -4
- package/dist/index.js +462 -38
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +462 -39
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/agent-harness.d.mts
CHANGED
|
@@ -82,7 +82,7 @@ interface BuildGranularAgentSystemPromptInput {
|
|
|
82
82
|
checkpoint?: GranularAgentExecutionCheckpoint | null;
|
|
83
83
|
}
|
|
84
84
|
interface GeneratedJobCodeIssue {
|
|
85
|
-
code: "commonjs_require" | "placeholder_after_confirm" | "placeholder_after_ask_user" | "disambiguation_requires_choice" | "missing_user_reply";
|
|
85
|
+
code: "commonjs_require" | "placeholder_after_confirm" | "placeholder_after_ask_user" | "disambiguation_requires_choice" | "missing_user_reply" | "return_show_not_for_ui";
|
|
86
86
|
severity: "error";
|
|
87
87
|
message: string;
|
|
88
88
|
}
|
package/dist/agent-harness.d.ts
CHANGED
|
@@ -82,7 +82,7 @@ interface BuildGranularAgentSystemPromptInput {
|
|
|
82
82
|
checkpoint?: GranularAgentExecutionCheckpoint | null;
|
|
83
83
|
}
|
|
84
84
|
interface GeneratedJobCodeIssue {
|
|
85
|
-
code: "commonjs_require" | "placeholder_after_confirm" | "placeholder_after_ask_user" | "disambiguation_requires_choice" | "missing_user_reply";
|
|
85
|
+
code: "commonjs_require" | "placeholder_after_confirm" | "placeholder_after_ask_user" | "disambiguation_requires_choice" | "missing_user_reply" | "return_show_not_for_ui";
|
|
86
86
|
severity: "error";
|
|
87
87
|
message: string;
|
|
88
88
|
}
|
package/dist/agent-harness.js
CHANGED
|
@@ -139,14 +139,22 @@ function reviewGeneratedJobCode(code) {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
const hasConversationalReturn = /return\s+[`'"]/.test(normalized) || /\breply\s*:/.test(normalized) || /\bagent_message\s*\(/.test(normalized);
|
|
142
|
+
const hasConversationalReturn = /return\s+[`'"]/.test(normalized) || /\breply\s*:/.test(normalized) || /\bagent_message\s*\(/.test(normalized) || /\bagent_text_message\s*\(/.test(normalized);
|
|
143
143
|
const returnsObjectLiteral = /return\s+\{[\s\S]*?\}/.test(normalized);
|
|
144
|
+
const returnsShowPayload = /return\s+\{[\s\S]*?\bshow\s*:/.test(normalized);
|
|
144
145
|
const closesLoop = /loop\.close_loop\s*\(/.test(normalized);
|
|
145
146
|
if (!hasConversationalReturn && returnsObjectLiteral && !closesLoop) {
|
|
146
147
|
issues.push({
|
|
147
148
|
code: "missing_user_reply",
|
|
148
149
|
severity: "error",
|
|
149
|
-
message: "User-facing jobs must end with a natural-language answer. Return a short string, an object with a top-level `reply` string, or
|
|
150
|
+
message: "User-facing jobs must end with a natural-language answer. Return a short string, an object with a top-level `reply` string, or post text with agent_text_message(...). Do not end with bare structured JSON."
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
if (returnsShowPayload) {
|
|
154
|
+
issues.push({
|
|
155
|
+
code: "return_show_not_for_ui",
|
|
156
|
+
severity: "error",
|
|
157
|
+
message: "Do not use the final return value to send UI record refs through `show`. Use agent_heap_objects(...) for heap-backed UI, then return plain text if you still want a final textual answer."
|
|
150
158
|
});
|
|
151
159
|
}
|
|
152
160
|
return issues;
|
|
@@ -996,7 +1004,7 @@ ${loopBlock}
|
|
|
996
1004
|
|
|
997
1005
|
\u2500\u2500\u2500 CODE RULES \u2500\u2500\u2500
|
|
998
1006
|
- Import from \`./sandbox-tools\`.
|
|
999
|
-
- If you use \`heap\`, \`loop\`, or \`agent_message\`, import them explicitly from \`./sandbox-tools\`.
|
|
1007
|
+
- If you use \`heap\`, \`loop\`, \`agent_text_message\`, \`agent_heap_objects\`, or legacy \`agent_message\`, import them explicitly from \`./sandbox-tools\`.
|
|
1000
1008
|
- Write top-level executable code with \`await\` at top level.
|
|
1001
1009
|
- The generated job body must be plain runnable JavaScript. The DOMAIN TYPES block is only a reference for shapes and available methods.
|
|
1002
1010
|
- Do not write TypeScript-only syntax in executable code: no type annotations, no interfaces, no enums, no \`as Type\` casts, no \`satisfies\`, and no generic type parameters in code.
|
|
@@ -1038,14 +1046,17 @@ ${loopBlock}
|
|
|
1038
1046
|
- \`loop.close_loop(...)\`: record the current workflow outcome with a short summary before stopping. Do not call it in the same job that opens a new user prompt unless the workflow is explicitly blocked. This does not end the session forever.
|
|
1039
1047
|
- Avoid \`as any\` and other broad casts when the DOMAIN TYPES block already tells you the correct class or list type.
|
|
1040
1048
|
- Prefer manipulating heap-backed instances and typed lists instead of returning raw JSON blobs or object IDs unless the user explicitly asks for them.
|
|
1041
|
-
-
|
|
1042
|
-
-
|
|
1043
|
-
-
|
|
1044
|
-
- \`
|
|
1045
|
-
- \`
|
|
1046
|
-
-
|
|
1047
|
-
|
|
1048
|
-
-
|
|
1049
|
+
- Every job that intends to answer the user must emit at least one explicit UI message with \`agent_text_message(...)\` and/or \`agent_heap_objects(...)\`.
|
|
1050
|
+
- Use \`agent_text_message("...")\` for all user-visible text shown in the UI.
|
|
1051
|
+
- Use \`agent_heap_objects(...)\` only when you want the UI to render heap-backed records or lists.
|
|
1052
|
+
- If you want to show both text and records, call \`agent_text_message(...)\` and \`agent_heap_objects(...)\` separately in whatever order fits the interaction.
|
|
1053
|
+
- \`agent_text_message(...)\` should be used with a plain text string in normal generated code.
|
|
1054
|
+
- \`agent_heap_objects(...)\` should point at heap-backed values: explicit \`entryPaths\` / \`listNames\` / \`variableNames\`, a named list saved with \`saveAs\`, or values read back from \`heap.getVar(...)\`.
|
|
1055
|
+
- If you just fetched records and want to show them in the UI, save or reference them through the heap first, then call \`agent_heap_objects(...)\`. Do not try to hand-build UI payloads in job code.
|
|
1056
|
+
- Do not assume heap changes will be displayed automatically. If records should appear in the UI, you must call \`agent_heap_objects(...)\`.
|
|
1057
|
+
- Never write \`return { reply, show }\` or \`return { show: ... }\` for UI. If you want the UI to render records or lists, call \`agent_heap_objects(...)\` instead.
|
|
1058
|
+
- Do not rely on the final return value for user-visible output. A plain return value is not considered a displayed UI answer.
|
|
1059
|
+
- \`agent_message(...)\` remains available as a legacy compatibility alias, but prefer \`agent_text_message(...)\` and \`agent_heap_objects(...)\` in new code.
|
|
1049
1060
|
- Do not return bare structured JSON, low-level diagnostics, or database-shaped payloads as the final answer unless the user explicitly asks for them.
|
|
1050
1061
|
- Prefer simple executable JavaScript over clever interpolation. Avoid nested template literals or unusually dense inline expressions when a small temporary variable or string concatenation would be clearer and safer.
|
|
1051
1062
|
- Use \`console.log()\` only for intermediate diagnostics, not for the final user-facing answer.`;
|