@code-yeongyu/senpi 2026.7.11 → 2026.7.13
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/CHANGELOG.md +17 -0
- package/dist/core/agent-session.d.ts +9 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +56 -15
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js +76 -25
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js.map +1 -1
- package/dist/core/resource-loader.d.ts +1 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +20 -2
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/modes/interactive/compaction-queue-transfer.d.ts +22 -0
- package/dist/modes/interactive/compaction-queue-transfer.d.ts.map +1 -0
- package/dist/modes/interactive/compaction-queue-transfer.js +82 -0
- package/dist/modes/interactive/compaction-queue-transfer.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +4 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +83 -69
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/node_modules/@babel/helper-string-parser/LICENSE +22 -0
- package/node_modules/@babel/helper-string-parser/README.md +19 -0
- package/node_modules/@babel/helper-string-parser/lib/index.js +295 -0
- package/node_modules/@babel/helper-string-parser/lib/index.js.map +1 -0
- package/node_modules/@babel/helper-string-parser/package.json +31 -0
- package/node_modules/@babel/helper-validator-identifier/LICENSE +22 -0
- package/node_modules/@babel/helper-validator-identifier/README.md +19 -0
- package/node_modules/@babel/helper-validator-identifier/lib/identifier.js +70 -0
- package/node_modules/@babel/helper-validator-identifier/lib/identifier.js.map +1 -0
- package/node_modules/@babel/helper-validator-identifier/lib/index.js +57 -0
- package/node_modules/@babel/helper-validator-identifier/lib/index.js.map +1 -0
- package/node_modules/@babel/helper-validator-identifier/lib/keyword.js +35 -0
- package/node_modules/@babel/helper-validator-identifier/lib/keyword.js.map +1 -0
- package/node_modules/@babel/helper-validator-identifier/package.json +31 -0
- package/node_modules/@babel/parser/LICENSE +19 -0
- package/node_modules/@babel/parser/README.md +19 -0
- package/node_modules/@babel/parser/bin/babel-parser.js +15 -0
- package/node_modules/@babel/parser/lib/index.js +14599 -0
- package/node_modules/@babel/parser/lib/index.js.map +1 -0
- package/node_modules/@babel/parser/package.json +50 -0
- package/node_modules/@babel/parser/typings/babel-parser.d.ts +262 -0
- package/node_modules/@babel/types/LICENSE +22 -0
- package/node_modules/@babel/types/README.md +19 -0
- package/node_modules/@babel/types/lib/asserts/assertNode.js +16 -0
- package/node_modules/@babel/types/lib/asserts/assertNode.js.map +1 -0
- package/node_modules/@babel/types/lib/asserts/generated/index.js +1251 -0
- package/node_modules/@babel/types/lib/asserts/generated/index.js.map +1 -0
- package/node_modules/@babel/types/lib/ast-types/generated/index.js +3 -0
- package/node_modules/@babel/types/lib/ast-types/generated/index.js.map +1 -0
- package/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js +18 -0
- package/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js.map +1 -0
- package/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js +31 -0
- package/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js.map +1 -0
- package/node_modules/@babel/types/lib/builders/generated/index.js +29 -0
- package/node_modules/@babel/types/lib/builders/generated/index.js.map +1 -0
- package/node_modules/@babel/types/lib/builders/generated/lowercase.js +2902 -0
- package/node_modules/@babel/types/lib/builders/generated/lowercase.js.map +1 -0
- package/node_modules/@babel/types/lib/builders/generated/uppercase.js +272 -0
- package/node_modules/@babel/types/lib/builders/generated/uppercase.js.map +1 -0
- package/node_modules/@babel/types/lib/builders/productions.js +12 -0
- package/node_modules/@babel/types/lib/builders/productions.js.map +1 -0
- package/node_modules/@babel/types/lib/builders/react/buildChildren.js +24 -0
- package/node_modules/@babel/types/lib/builders/react/buildChildren.js.map +1 -0
- package/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js +22 -0
- package/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js.map +1 -0
- package/node_modules/@babel/types/lib/builders/validateNode.js +21 -0
- package/node_modules/@babel/types/lib/builders/validateNode.js.map +1 -0
- package/node_modules/@babel/types/lib/clone/clone.js +12 -0
- package/node_modules/@babel/types/lib/clone/clone.js.map +1 -0
- package/node_modules/@babel/types/lib/clone/cloneDeep.js +12 -0
- package/node_modules/@babel/types/lib/clone/cloneDeep.js.map +1 -0
- package/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js +12 -0
- package/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js.map +1 -0
- package/node_modules/@babel/types/lib/clone/cloneNode.js +107 -0
- package/node_modules/@babel/types/lib/clone/cloneNode.js.map +1 -0
- package/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js +12 -0
- package/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js.map +1 -0
- package/node_modules/@babel/types/lib/comments/addComment.js +15 -0
- package/node_modules/@babel/types/lib/comments/addComment.js.map +1 -0
- package/node_modules/@babel/types/lib/comments/addComments.js +22 -0
- package/node_modules/@babel/types/lib/comments/addComments.js.map +1 -0
- package/node_modules/@babel/types/lib/comments/inheritInnerComments.js +12 -0
- package/node_modules/@babel/types/lib/comments/inheritInnerComments.js.map +1 -0
- package/node_modules/@babel/types/lib/comments/inheritLeadingComments.js +12 -0
- package/node_modules/@babel/types/lib/comments/inheritLeadingComments.js.map +1 -0
- package/node_modules/@babel/types/lib/comments/inheritTrailingComments.js +12 -0
- package/node_modules/@babel/types/lib/comments/inheritTrailingComments.js.map +1 -0
- package/node_modules/@babel/types/lib/comments/inheritsComments.js +17 -0
- package/node_modules/@babel/types/lib/comments/inheritsComments.js.map +1 -0
- package/node_modules/@babel/types/lib/comments/removeComments.js +15 -0
- package/node_modules/@babel/types/lib/comments/removeComments.js.map +1 -0
- package/node_modules/@babel/types/lib/constants/generated/index.js +60 -0
- package/node_modules/@babel/types/lib/constants/generated/index.js.map +1 -0
- package/node_modules/@babel/types/lib/constants/index.js +31 -0
- package/node_modules/@babel/types/lib/constants/index.js.map +1 -0
- package/node_modules/@babel/types/lib/converters/ensureBlock.js +14 -0
- package/node_modules/@babel/types/lib/converters/ensureBlock.js.map +1 -0
- package/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js +65 -0
- package/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js.map +1 -0
- package/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js +14 -0
- package/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js.map +1 -0
- package/node_modules/@babel/types/lib/converters/toBlock.js +29 -0
- package/node_modules/@babel/types/lib/converters/toBlock.js.map +1 -0
- package/node_modules/@babel/types/lib/converters/toComputedKey.js +14 -0
- package/node_modules/@babel/types/lib/converters/toComputedKey.js.map +1 -0
- package/node_modules/@babel/types/lib/converters/toExpression.js +28 -0
- package/node_modules/@babel/types/lib/converters/toExpression.js.map +1 -0
- package/node_modules/@babel/types/lib/converters/toIdentifier.js +25 -0
- package/node_modules/@babel/types/lib/converters/toIdentifier.js.map +1 -0
- package/node_modules/@babel/types/lib/converters/toKeyAlias.js +38 -0
- package/node_modules/@babel/types/lib/converters/toKeyAlias.js.map +1 -0
- package/node_modules/@babel/types/lib/converters/toSequenceExpression.js +19 -0
- package/node_modules/@babel/types/lib/converters/toSequenceExpression.js.map +1 -0
- package/node_modules/@babel/types/lib/converters/toStatement.js +39 -0
- package/node_modules/@babel/types/lib/converters/toStatement.js.map +1 -0
- package/node_modules/@babel/types/lib/converters/valueToNode.js +89 -0
- package/node_modules/@babel/types/lib/converters/valueToNode.js.map +1 -0
- package/node_modules/@babel/types/lib/definitions/core.js +1725 -0
- package/node_modules/@babel/types/lib/definitions/core.js.map +1 -0
- package/node_modules/@babel/types/lib/definitions/deprecated-aliases.js +11 -0
- package/node_modules/@babel/types/lib/definitions/deprecated-aliases.js.map +1 -0
- package/node_modules/@babel/types/lib/definitions/experimental.js +124 -0
- package/node_modules/@babel/types/lib/definitions/experimental.js.map +1 -0
- package/node_modules/@babel/types/lib/definitions/flow.js +495 -0
- package/node_modules/@babel/types/lib/definitions/flow.js.map +1 -0
- package/node_modules/@babel/types/lib/definitions/index.js +106 -0
- package/node_modules/@babel/types/lib/definitions/index.js.map +1 -0
- package/node_modules/@babel/types/lib/definitions/jsx.js +157 -0
- package/node_modules/@babel/types/lib/definitions/jsx.js.map +1 -0
- package/node_modules/@babel/types/lib/definitions/misc.js +31 -0
- package/node_modules/@babel/types/lib/definitions/misc.js.map +1 -0
- package/node_modules/@babel/types/lib/definitions/placeholders.js +27 -0
- package/node_modules/@babel/types/lib/definitions/placeholders.js.map +1 -0
- package/node_modules/@babel/types/lib/definitions/typescript.js +528 -0
- package/node_modules/@babel/types/lib/definitions/typescript.js.map +1 -0
- package/node_modules/@babel/types/lib/definitions/utils.js +296 -0
- package/node_modules/@babel/types/lib/definitions/utils.js.map +1 -0
- package/node_modules/@babel/types/lib/index-legacy.d.ts +2797 -0
- package/node_modules/@babel/types/lib/index.d.ts +3617 -0
- package/node_modules/@babel/types/lib/index.js +582 -0
- package/node_modules/@babel/types/lib/index.js.flow +2650 -0
- package/node_modules/@babel/types/lib/index.js.map +1 -0
- package/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js +15 -0
- package/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js.map +1 -0
- package/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js +65 -0
- package/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js.map +1 -0
- package/node_modules/@babel/types/lib/modifications/inherits.js +28 -0
- package/node_modules/@babel/types/lib/modifications/inherits.js.map +1 -0
- package/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js +17 -0
- package/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js.map +1 -0
- package/node_modules/@babel/types/lib/modifications/removeProperties.js +24 -0
- package/node_modules/@babel/types/lib/modifications/removeProperties.js.map +1 -0
- package/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js +14 -0
- package/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js.map +1 -0
- package/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js +66 -0
- package/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js.map +1 -0
- package/node_modules/@babel/types/lib/retrievers/getAssignmentIdentifiers.js +48 -0
- package/node_modules/@babel/types/lib/retrievers/getAssignmentIdentifiers.js.map +1 -0
- package/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js +102 -0
- package/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js.map +1 -0
- package/node_modules/@babel/types/lib/retrievers/getFunctionName.js +63 -0
- package/node_modules/@babel/types/lib/retrievers/getFunctionName.js.map +1 -0
- package/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js +13 -0
- package/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js.map +1 -0
- package/node_modules/@babel/types/lib/traverse/traverse.js +50 -0
- package/node_modules/@babel/types/lib/traverse/traverse.js.map +1 -0
- package/node_modules/@babel/types/lib/traverse/traverseFast.js +40 -0
- package/node_modules/@babel/types/lib/traverse/traverseFast.js.map +1 -0
- package/node_modules/@babel/types/lib/utils/deprecationWarning.js +44 -0
- package/node_modules/@babel/types/lib/utils/deprecationWarning.js.map +1 -0
- package/node_modules/@babel/types/lib/utils/inherit.js +13 -0
- package/node_modules/@babel/types/lib/utils/inherit.js.map +1 -0
- package/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js +40 -0
- package/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js.map +1 -0
- package/node_modules/@babel/types/lib/utils/shallowEqual.js +17 -0
- package/node_modules/@babel/types/lib/utils/shallowEqual.js.map +1 -0
- package/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js +13 -0
- package/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js.map +1 -0
- package/node_modules/@babel/types/lib/validators/generated/index.js +2797 -0
- package/node_modules/@babel/types/lib/validators/generated/index.js.map +1 -0
- package/node_modules/@babel/types/lib/validators/is.js +27 -0
- package/node_modules/@babel/types/lib/validators/is.js.map +1 -0
- package/node_modules/@babel/types/lib/validators/isBinding.js +27 -0
- package/node_modules/@babel/types/lib/validators/isBinding.js.map +1 -0
- package/node_modules/@babel/types/lib/validators/isBlockScoped.js +13 -0
- package/node_modules/@babel/types/lib/validators/isBlockScoped.js.map +1 -0
- package/node_modules/@babel/types/lib/validators/isImmutable.js +21 -0
- package/node_modules/@babel/types/lib/validators/isImmutable.js.map +1 -0
- package/node_modules/@babel/types/lib/validators/isLet.js +13 -0
- package/node_modules/@babel/types/lib/validators/isLet.js.map +1 -0
- package/node_modules/@babel/types/lib/validators/isNode.js +12 -0
- package/node_modules/@babel/types/lib/validators/isNode.js.map +1 -0
- package/node_modules/@babel/types/lib/validators/isNodesEquivalent.js +57 -0
- package/node_modules/@babel/types/lib/validators/isNodesEquivalent.js.map +1 -0
- package/node_modules/@babel/types/lib/validators/isPlaceholderType.js +15 -0
- package/node_modules/@babel/types/lib/validators/isPlaceholderType.js.map +1 -0
- package/node_modules/@babel/types/lib/validators/isReferenced.js +96 -0
- package/node_modules/@babel/types/lib/validators/isReferenced.js.map +1 -0
- package/node_modules/@babel/types/lib/validators/isScope.js +18 -0
- package/node_modules/@babel/types/lib/validators/isScope.js.map +1 -0
- package/node_modules/@babel/types/lib/validators/isSpecifierDefault.js +14 -0
- package/node_modules/@babel/types/lib/validators/isSpecifierDefault.js.map +1 -0
- package/node_modules/@babel/types/lib/validators/isType.js +17 -0
- package/node_modules/@babel/types/lib/validators/isType.js.map +1 -0
- package/node_modules/@babel/types/lib/validators/isValidES3Identifier.js +13 -0
- package/node_modules/@babel/types/lib/validators/isValidES3Identifier.js.map +1 -0
- package/node_modules/@babel/types/lib/validators/isValidIdentifier.js +18 -0
- package/node_modules/@babel/types/lib/validators/isValidIdentifier.js.map +1 -0
- package/node_modules/@babel/types/lib/validators/isVar.js +15 -0
- package/node_modules/@babel/types/lib/validators/isVar.js.map +1 -0
- package/node_modules/@babel/types/lib/validators/matchesPattern.js +44 -0
- package/node_modules/@babel/types/lib/validators/matchesPattern.js.map +1 -0
- package/node_modules/@babel/types/lib/validators/react/isCompatTag.js +11 -0
- package/node_modules/@babel/types/lib/validators/react/isCompatTag.js.map +1 -0
- package/node_modules/@babel/types/lib/validators/react/isReactComponent.js +11 -0
- package/node_modules/@babel/types/lib/validators/react/isReactComponent.js.map +1 -0
- package/node_modules/@babel/types/lib/validators/validate.js +42 -0
- package/node_modules/@babel/types/lib/validators/validate.js.map +1 -0
- package/node_modules/@babel/types/package.json +39 -0
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +10 -2
- package/node_modules/@code-yeongyu/senpi-codemode/README.md +128 -78
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -3
- package/node_modules/@code-yeongyu/senpi-codemode/src/bridge/protocol.ts +15 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/bridge/reserved.ts +9 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/bridges/agent-bridge.ts +197 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/bridges/output-bridge.ts +96 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/bridges/schema-injection.ts +3 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/completion/handler.ts +95 -26
- package/node_modules/@code-yeongyu/senpi-codemode/src/completion/tool-bridge.ts +11 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/config/settings.ts +96 -8
- package/node_modules/@code-yeongyu/senpi-codemode/src/extension/session-manager.ts +24 -3
- package/node_modules/@code-yeongyu/senpi-codemode/src/index.ts +155 -21
- package/node_modules/@code-yeongyu/senpi-codemode/src/interpreters/detect.ts +1 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/jl/prelude.jl +252 -48
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/jl/runner.jl +263 -83
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/context-manager.ts +11 -5
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/local-module-loader.ts +108 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/prelude.ts +8 -6
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/rewrite-imports.ts +164 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-core.js +6 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-runtime.js +307 -41
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/py/kernel.ts +3 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/py/prelude.py +792 -79
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/rb/prelude.rb +234 -21
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/rb/runner.rb +154 -51
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/shared/subprocess-queue.ts +1 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/output/output-meta.ts +89 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/output/streaming-output.ts +296 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/prompt/eval-prompt.ts +107 -30
- package/node_modules/@code-yeongyu/senpi-codemode/src/timeouts/bridge-timeout.ts +2 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/timeouts/idle-timeout.ts +8 -19
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/cell-handler.ts +175 -113
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool.ts +130 -120
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/image.ts +274 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/json-tree.ts +247 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/render.ts +641 -38
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/status-events.ts +12 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/types.ts +29 -1
- package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js +16 -16
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.js +6 -6
- package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = validate;
|
|
7
|
+
exports.validateChild = validateChild;
|
|
8
|
+
exports.validateField = validateField;
|
|
9
|
+
exports.validateInternal = validateInternal;
|
|
10
|
+
var _index = require("../definitions/index.js");
|
|
11
|
+
function validate(node, key, val) {
|
|
12
|
+
if (!node) return;
|
|
13
|
+
const fields = _index.NODE_FIELDS[node.type];
|
|
14
|
+
if (!fields) return;
|
|
15
|
+
const field = fields[key];
|
|
16
|
+
validateField(node, key, val, field);
|
|
17
|
+
validateChild(node, key, val);
|
|
18
|
+
}
|
|
19
|
+
function validateInternal(field, node, key, val, maybeNode) {
|
|
20
|
+
if (!(field != null && field.validate)) return;
|
|
21
|
+
if (field.optional && val == null) return;
|
|
22
|
+
field.validate(node, key, val);
|
|
23
|
+
if (maybeNode) {
|
|
24
|
+
var _NODE_PARENT_VALIDATI;
|
|
25
|
+
const type = val.type;
|
|
26
|
+
if (type == null) return;
|
|
27
|
+
(_NODE_PARENT_VALIDATI = _index.NODE_PARENT_VALIDATIONS[type]) == null || _NODE_PARENT_VALIDATI.call(_index.NODE_PARENT_VALIDATIONS, node, key, val);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function validateField(node, key, val, field) {
|
|
31
|
+
if (!(field != null && field.validate)) return;
|
|
32
|
+
if (field.optional && val == null) return;
|
|
33
|
+
field.validate(node, key, val);
|
|
34
|
+
}
|
|
35
|
+
function validateChild(node, key, val) {
|
|
36
|
+
var _NODE_PARENT_VALIDATI2;
|
|
37
|
+
const type = val == null ? void 0 : val.type;
|
|
38
|
+
if (type == null) return;
|
|
39
|
+
(_NODE_PARENT_VALIDATI2 = _index.NODE_PARENT_VALIDATIONS[type]) == null || _NODE_PARENT_VALIDATI2.call(_index.NODE_PARENT_VALIDATIONS, node, key, val);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_index","require","validate","node","key","val","fields","NODE_FIELDS","type","field","validateField","validateChild","validateInternal","maybeNode","optional","_NODE_PARENT_VALIDATI","NODE_PARENT_VALIDATIONS","call","_NODE_PARENT_VALIDATI2"],"sources":["../../src/validators/validate.ts"],"sourcesContent":["import {\n NODE_FIELDS,\n NODE_PARENT_VALIDATIONS,\n type FieldOptions,\n} from \"../definitions/index.ts\";\nimport type * as t from \"../index.ts\";\n\nexport default function validate(\n node: t.Node | undefined | null,\n key: string,\n val: unknown,\n): void {\n if (!node) return;\n\n const fields = NODE_FIELDS[node.type];\n if (!fields) return;\n\n const field = fields[key];\n validateField(node, key, val, field);\n validateChild(node, key, val);\n}\n\nexport function validateInternal(\n field: FieldOptions,\n node: t.Node | undefined | null,\n key: string,\n val: unknown,\n maybeNode?: 1,\n): void {\n if (!field?.validate) return;\n if (field.optional && val == null) return;\n\n field.validate(node, key, val);\n\n if (maybeNode) {\n const type = (val as t.Node).type;\n if (type == null) return;\n NODE_PARENT_VALIDATIONS[type]?.(node, key, val);\n }\n}\n\nexport function validateField(\n node: t.Node | undefined | null,\n key: string,\n val: unknown,\n field: FieldOptions | undefined | null,\n): void {\n if (!field?.validate) return;\n if (field.optional && val == null) return;\n\n field.validate(node, key, val);\n}\n\nexport function validateChild(\n node: t.Node | undefined | null,\n key: string | { toString(): string },\n val?: unknown,\n) {\n const type = (val as t.Node)?.type;\n if (type == null) return;\n NODE_PARENT_VALIDATIONS[type]?.(node, key, val);\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAOe,SAASC,QAAQA,CAC9BC,IAA+B,EAC/BC,GAAW,EACXC,GAAY,EACN;EACN,IAAI,CAACF,IAAI,EAAE;EAEX,MAAMG,MAAM,GAAGC,kBAAW,CAACJ,IAAI,CAACK,IAAI,CAAC;EACrC,IAAI,CAACF,MAAM,EAAE;EAEb,MAAMG,KAAK,GAAGH,MAAM,CAACF,GAAG,CAAC;EACzBM,aAAa,CAACP,IAAI,EAAEC,GAAG,EAAEC,GAAG,EAAEI,KAAK,CAAC;EACpCE,aAAa,CAACR,IAAI,EAAEC,GAAG,EAAEC,GAAG,CAAC;AAC/B;AAEO,SAASO,gBAAgBA,CAC9BH,KAAmB,EACnBN,IAA+B,EAC/BC,GAAW,EACXC,GAAY,EACZQ,SAAa,EACP;EACN,IAAI,EAACJ,KAAK,YAALA,KAAK,CAAEP,QAAQ,GAAE;EACtB,IAAIO,KAAK,CAACK,QAAQ,IAAIT,GAAG,IAAI,IAAI,EAAE;EAEnCI,KAAK,CAACP,QAAQ,CAACC,IAAI,EAAEC,GAAG,EAAEC,GAAG,CAAC;EAE9B,IAAIQ,SAAS,EAAE;IAAA,IAAAE,qBAAA;IACb,MAAMP,IAAI,GAAIH,GAAG,CAAYG,IAAI;IACjC,IAAIA,IAAI,IAAI,IAAI,EAAE;IAClB,CAAAO,qBAAA,GAAAC,8BAAuB,CAACR,IAAI,CAAC,aAA7BO,qBAAA,CAAAE,IAAA,CAAAD,8BAAuB,EAASb,IAAI,EAAEC,GAAG,EAAEC,GAAG,CAAC;EACjD;AACF;AAEO,SAASK,aAAaA,CAC3BP,IAA+B,EAC/BC,GAAW,EACXC,GAAY,EACZI,KAAsC,EAChC;EACN,IAAI,EAACA,KAAK,YAALA,KAAK,CAAEP,QAAQ,GAAE;EACtB,IAAIO,KAAK,CAACK,QAAQ,IAAIT,GAAG,IAAI,IAAI,EAAE;EAEnCI,KAAK,CAACP,QAAQ,CAACC,IAAI,EAAEC,GAAG,EAAEC,GAAG,CAAC;AAChC;AAEO,SAASM,aAAaA,CAC3BR,IAA+B,EAC/BC,GAAoC,EACpCC,GAAa,EACb;EAAA,IAAAa,sBAAA;EACA,MAAMV,IAAI,GAAIH,GAAG,oBAAHA,GAAG,CAAaG,IAAI;EAClC,IAAIA,IAAI,IAAI,IAAI,EAAE;EAClB,CAAAU,sBAAA,GAAAF,8BAAuB,CAACR,IAAI,CAAC,aAA7BU,sBAAA,CAAAD,IAAA,CAAAD,8BAAuB,EAASb,IAAI,EAAEC,GAAG,EAAEC,GAAG,CAAC;AACjD","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@babel/types",
|
|
3
|
+
"version": "7.29.7",
|
|
4
|
+
"description": "Babel Types is a Lodash-esque utility library for AST nodes",
|
|
5
|
+
"author": "The Babel Team (https://babel.dev/team)",
|
|
6
|
+
"homepage": "https://babel.dev/docs/en/next/babel-types",
|
|
7
|
+
"bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20types%22+is%3Aopen",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/babel/babel.git",
|
|
15
|
+
"directory": "packages/babel-types"
|
|
16
|
+
},
|
|
17
|
+
"main": "./lib/index.js",
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@babel/helper-string-parser": "^7.29.7",
|
|
20
|
+
"@babel/helper-validator-identifier": "^7.29.7"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@babel/generator": "^7.29.7",
|
|
24
|
+
"@babel/helper-fixtures": "^7.29.7",
|
|
25
|
+
"@babel/parser": "^7.29.7"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=6.9.0"
|
|
29
|
+
},
|
|
30
|
+
"type": "commonjs",
|
|
31
|
+
"types": "./lib/index-legacy.d.ts",
|
|
32
|
+
"typesVersions": {
|
|
33
|
+
">=4.1": {
|
|
34
|
+
"lib/index-legacy.d.ts": [
|
|
35
|
+
"lib/index.d.ts"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [
|
|
3
|
+
## [2026.7.13] - 2026-07-13
|
|
4
4
|
|
|
5
5
|
### Added
|
|
6
6
|
|
|
7
7
|
- Added the source-only `@code-yeongyu/senpi-codemode` workspace package scaffold.
|
|
8
8
|
- Added codemode settings loading, interpreter detection, prompt generation, loopback bridge helpers, and persistent JS/Python/Ruby/Julia kernel building blocks.
|
|
9
|
+
- Added structured kernel status events from the bridge through TUI rendering.
|
|
10
|
+
- Added `agent()` and `output()` bridges that delegate through configured task-tool contracts.
|
|
11
|
+
- Added bounded streaming output with session-adjacent spill files and plain-path notices.
|
|
12
|
+
- Added eval render parity for highlighted cells, status rows, task progress, JSON displays, truncation warnings, and image fallbacks.
|
|
13
|
+
- Added JavaScript import rewriting for persistent eval cells.
|
|
9
14
|
|
|
10
15
|
### Changed
|
|
11
16
|
|
|
12
|
-
-
|
|
17
|
+
- Activated the exported extension factory so the bundled package registers and reconfigures the persistent-kernel `eval` tool in Senpi sessions.
|
|
13
18
|
- Improved `eval` TUI rendering with streaming status and timing, bounded expandable previews, width-safe ANSI/CJK/emoji reflow, nested tool-call state, and terminal-aware image fallbacks.
|
|
19
|
+
- Re-register the eval prompt and schema at session start after settings, interpreter availability, and active task-tool names resolve.
|
|
20
|
+
- Recorded the completed oh-my-pi eval-port provenance for this extension; task delegation and artifact handling follow Senpi extension boundaries.
|
|
14
21
|
|
|
15
22
|
### Fixed
|
|
16
23
|
|
|
@@ -20,3 +27,4 @@
|
|
|
20
27
|
- Fixed a temporal-dead-zone crash in the `eval` tool: subprocess kernels (py/rb/jl) emit their `ready` frame synchronously during kernel startup, which invoked the message handler before the `kernel` binding initialized and crashed the whole agent process. The self-referential binding is now hoisted so startup frames no longer throw.
|
|
21
28
|
- Fixed cell-output misattribution on reused persistent kernels: `getKernel` now rebinds the per-cell `onMessage` on every call, so a second (and later) cell's streamed `text`/`display`/`log` output is delivered to that cell instead of the previous one.
|
|
22
29
|
- Fixed the Ruby kernel corrupting its JSONL protocol channel: user `puts`/`print` output is now captured via a redirected `$stdout` and emitted as `text` frames instead of being written directly onto the shared stdout stream.
|
|
30
|
+
- Fixed the Ruby kernel raising `ArgumentError: unknown keywords` on Ruby 3.0+ (e.g. CI's Ruby 3.x, while local Ruby 2.6 masked it): `env()`/`read()`/`write()` passed braceless string-keyed hashes to `__senpi_emit_status`, which Ruby 3 parses as keyword arguments against its `force:` keyword parameter instead of the positional `fields` hash. The field hashes are now wrapped in explicit braces so status emission and final-expression auto-display work identically across Ruby 2.6–3.4.
|
|
@@ -1,38 +1,44 @@
|
|
|
1
1
|
# @code-yeongyu/senpi-codemode
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
`@code-yeongyu/senpi-codemode` is Senpi's source-only persistent-kernel
|
|
4
|
+
`eval` extension. It registers `eval`, owns one persistent kernel per enabled
|
|
5
|
+
language, and re-registers the tool at session start after configuration,
|
|
6
|
+
interpreter availability, and active task-tool names are known.
|
|
7
|
+
|
|
8
|
+
## Capabilities
|
|
9
|
+
|
|
10
|
+
- Persistent JavaScript, Python, Ruby, and Julia cells. State survives later
|
|
11
|
+
cells in the same language until reset, restart, or session disposal.
|
|
12
|
+
- Loopback, bearer-authenticated kernel bridge with bounded JSONL frames.
|
|
13
|
+
- Structured status events for file operations, environment access, phases,
|
|
14
|
+
bridge activity, and delegated task progress.
|
|
15
|
+
- Bounded streaming output with head/tail previews, column clamping, and
|
|
16
|
+
session-adjacent spill files for large streams.
|
|
17
|
+
- TUI and HTML-export rendering for syntax-highlighted cells, status rows,
|
|
18
|
+
task progress, structured display values, truncation warnings, and image
|
|
19
|
+
fallbacks.
|
|
20
|
+
- JavaScript import rewriting for supported local modules and package imports
|
|
21
|
+
in the persistent Node.js worker.
|
|
11
22
|
|
|
12
23
|
## Kernels
|
|
13
24
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
|
19
|
-
|
|
20
|
-
| `js` | enabled | Node.js worker |
|
|
21
|
-
| `py` | enabled | `python3` or `python` on POSIX; `python`, `py -3`, or `python3` on Windows |
|
|
22
|
-
| `rb` | disabled | `ruby` |
|
|
23
|
-
| `jl` | disabled | `julia` |
|
|
25
|
+
| Language | Default | Runtime | Notes |
|
|
26
|
+
| --- | --- | --- | --- |
|
|
27
|
+
| `js` | enabled | Node.js worker | Requires Node.js 24 or newer; supports top-level `await` and `return`. |
|
|
28
|
+
| `py` | enabled | `python3` or `python` | Optional interpreter detected at session start. |
|
|
29
|
+
| `rb` | disabled | `ruby` | Optional interpreter detected at session start. |
|
|
30
|
+
| `jl` | disabled | `julia` | Optional interpreter detected at session start. |
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
A missing optional interpreter removes that language from the session's `eval`
|
|
33
|
+
schema; it is not an installation failure.
|
|
27
34
|
|
|
28
35
|
## Settings
|
|
29
36
|
|
|
30
|
-
|
|
31
|
-
config:
|
|
37
|
+
Configuration is loaded in this order:
|
|
32
38
|
|
|
33
|
-
1. `.senpi/codemode.json`
|
|
39
|
+
1. `.senpi/codemode.json` in the session working directory
|
|
34
40
|
2. `~/.senpi/agent/codemode.json`
|
|
35
|
-
3.
|
|
41
|
+
3. Built-in defaults
|
|
36
42
|
|
|
37
43
|
```json
|
|
38
44
|
{
|
|
@@ -43,60 +49,104 @@ config:
|
|
|
43
49
|
"jl": false
|
|
44
50
|
},
|
|
45
51
|
"cellTimeoutSeconds": 30,
|
|
46
|
-
"parallelPoolWidth": 4
|
|
52
|
+
"parallelPoolWidth": 4,
|
|
53
|
+
"taskTools": {
|
|
54
|
+
"task": "task",
|
|
55
|
+
"output": "task_output"
|
|
56
|
+
},
|
|
57
|
+
"outputSink": {
|
|
58
|
+
"headBytes": 20480,
|
|
59
|
+
"maxColumns": 768
|
|
60
|
+
},
|
|
61
|
+
"statusEvents": true
|
|
47
62
|
}
|
|
48
63
|
```
|
|
49
64
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
`
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
65
|
+
| Key | Default | Effect |
|
|
66
|
+
| --- | --- | --- |
|
|
67
|
+
| `languages` | `py`/`js` enabled; `rb`/`jl` disabled | Selects desired languages before interpreter detection. |
|
|
68
|
+
| `cellTimeoutSeconds` | `30` | Idle timeout for one cell unless the call supplies `timeout`. |
|
|
69
|
+
| `parallelPoolWidth` | `4` | Maximum concurrent `parallel()` thunks. |
|
|
70
|
+
| `taskTools.task` | `"task"` | Registered tool name used by `agent()`. |
|
|
71
|
+
| `taskTools.output` | `"task_output"` | Registered tool name used by `output()`. |
|
|
72
|
+
| `outputSink.headBytes` | `20480` | Bytes retained from the beginning of a middle-truncated preview; `0` disables it. |
|
|
73
|
+
| `outputSink.maxColumns` | `768` | Maximum rendered output columns; `0` disables column clamping. |
|
|
74
|
+
| `statusEvents` | `true` | Enables kernel status-event forwarding and rendering. |
|
|
75
|
+
|
|
76
|
+
`SENPI_CODEMODE_PY`, `SENPI_CODEMODE_JS`, `SENPI_CODEMODE_RB`, and
|
|
77
|
+
`SENPI_CODEMODE_JL` override the corresponding file setting. `1` or `true`
|
|
78
|
+
enables; `0` or `false` disables. Any other value leaves the file setting in
|
|
79
|
+
effect.
|
|
80
|
+
|
|
81
|
+
Malformed JSON or invalid settings fall back to defaults with a warning.
|
|
82
|
+
|
|
83
|
+
## Cell helpers
|
|
84
|
+
|
|
85
|
+
Python, JavaScript, Ruby, and Julia expose the same conceptual helpers. Python,
|
|
86
|
+
Ruby, and Julia use trailing keyword options; JavaScript uses one trailing
|
|
87
|
+
options object and asynchronous helpers are `await`-able.
|
|
88
|
+
|
|
89
|
+
| Helper | Contract |
|
|
90
|
+
| --- | --- |
|
|
91
|
+
| `display(value)` | Emits text, structured JSON, markdown, or supported image display data. |
|
|
92
|
+
| `print(value, ...)` | Emits text output. |
|
|
93
|
+
| `read(path, offset?, limit?)` | Reads text with 1-indexed line slicing. `local://` paths resolve under the session artifact root. |
|
|
94
|
+
| `write(path, content)` | Creates parent directories and writes text. `local://` paths persist in the session artifact root. |
|
|
95
|
+
| `env(key?, value?)` | Reads all kernel environment values, one value, or sets one value. |
|
|
96
|
+
| `tool.<name>(args)` | Invokes an active Senpi tool through the normal `pi.executeTool` pipeline. |
|
|
97
|
+
| `completion(prompt, model?, system?, schema?)` | Requests a one-shot host completion; `schema` asks the host to parse structured output. |
|
|
98
|
+
| `agent(prompt, ...)` | Delegates to the configured active `taskTools.task` tool. Supports background handles and structured JSON results. |
|
|
99
|
+
| `output(ids, format?, offset?, limit?)` | Delegates transcript retrieval to the configured active `taskTools.output` tool. |
|
|
100
|
+
| `parallel(thunks)` | Runs thunks through the configured bounded pool while preserving input order. |
|
|
101
|
+
| `pipeline(items, ...stages)` | Applies stages left to right with a barrier between stages. |
|
|
102
|
+
| `log(message)` / `phase(title)` | Emits progress text and starts a status phase. |
|
|
103
|
+
|
|
104
|
+
`agent()` is available only when the configured task tool is active in the
|
|
105
|
+
session. `output()` similarly requires the configured task-output tool. Missing
|
|
106
|
+
tools produce a clear availability error instead of importing an orchestration
|
|
107
|
+
package. `agent()` delegates through the tool contract, so task-engine
|
|
108
|
+
permissions, progress updates, and transcripts remain owned by that engine.
|
|
109
|
+
`isolated`, `apply`, and `merge` are accepted for compatibility but emit a
|
|
110
|
+
warning because this task-engine integration has no isolation model.
|
|
111
|
+
|
|
112
|
+
## Output and artifacts
|
|
113
|
+
|
|
114
|
+
Cell output is streamed while the cell runs. Large streams spill to an absolute
|
|
115
|
+
file after the default 50 KiB threshold. With a session file such as
|
|
116
|
+
`/path/session.jsonl`, artifacts live in `/path/session-artifacts/`; sessions
|
|
117
|
+
without a file use a unique temporary directory. Truncated results include a
|
|
118
|
+
plain-path notice such as `[Full output: /absolute/path/eval-….log]`.
|
|
119
|
+
|
|
120
|
+
## Deliberate differences from oh-my-pi
|
|
121
|
+
|
|
122
|
+
- There is no `budget` helper.
|
|
123
|
+
- There is no `artifact://` protocol. Spill references are ordinary absolute
|
|
124
|
+
file paths.
|
|
125
|
+
- `agent()` and `output()` compose registered task tools through
|
|
126
|
+
`pi.executeTool`; this package does not import a task-engine workspace
|
|
127
|
+
package.
|
|
128
|
+
- Task transcript formats are limited to full (`raw`) and trailing (`tail`)
|
|
129
|
+
output. Query, JSON, and stripped metadata formats are task-engine concerns.
|
|
130
|
+
|
|
131
|
+
## Security and lifecycle
|
|
132
|
+
|
|
133
|
+
Kernels run locally with the invoking user's permissions. The bridge listens on
|
|
134
|
+
loopback only and authenticates each session with a random bearer token.
|
|
135
|
+
Session generations fence retired kernels and callbacks; each cell settles once
|
|
136
|
+
across completion, errors, cancellation, timeout, bridge failure, or a kernel
|
|
137
|
+
crash.
|
|
138
|
+
|
|
139
|
+
## Validation
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
cd packages/senpi-codemode
|
|
143
|
+
npm test
|
|
144
|
+
|
|
145
|
+
cd ../..
|
|
146
|
+
npm run check
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Direct real-surface QA drivers live in `scripts/qa-*.ts`: kernel cells
|
|
150
|
+
(`qa-py-cell.ts`, `qa-js-cell.ts`, `qa-rb-cell.ts`, `qa-jl-cell.ts`), end-to-end
|
|
151
|
+
extension execution (`qa-e2e-eval.ts`), and renderer output
|
|
152
|
+
(`qa-render-dump.ts`).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-yeongyu/senpi-codemode",
|
|
3
|
-
"version": "2026.7.
|
|
3
|
+
"version": "2026.7.13",
|
|
4
4
|
"description": "Source-only senpi extension package for codemode evaluation tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -29,14 +29,15 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@
|
|
32
|
+
"@babel/parser": "7.29.7",
|
|
33
|
+
"@earendil-works/pi-ai": "^2026.7.13",
|
|
33
34
|
"typebox": "1.1.38"
|
|
34
35
|
},
|
|
35
36
|
"peerDependencies": {
|
|
36
37
|
"@code-yeongyu/senpi": "*"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
|
-
"@code-yeongyu/senpi": "2026.7.
|
|
40
|
+
"@code-yeongyu/senpi": "2026.7.13"
|
|
40
41
|
},
|
|
41
42
|
"keywords": [
|
|
42
43
|
"senpi",
|
|
@@ -11,9 +11,14 @@ const bridgeErrorSchema = Type.Object({
|
|
|
11
11
|
code: Type.Optional(Type.String()),
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
+
const statusEventSchema = Type.Object({ op: Type.String() }, { additionalProperties: true });
|
|
15
|
+
|
|
14
16
|
const connectionConfigSchema = Type.Object({
|
|
15
17
|
port: Type.Integer({ minimum: 1, maximum: 65_535 }),
|
|
16
18
|
token: Type.String({ minLength: 1 }),
|
|
19
|
+
localRoots: Type.Optional(Type.Record(Type.String(), Type.String())),
|
|
20
|
+
artifactsDir: Type.Optional(Type.String()),
|
|
21
|
+
parallelPoolWidth: Type.Optional(Type.Integer({ minimum: 1 })),
|
|
17
22
|
});
|
|
18
23
|
|
|
19
24
|
const hostToKernelMessageSchema = Type.Union([
|
|
@@ -70,6 +75,7 @@ const kernelToHostMessageSchema = Type.Union([
|
|
|
70
75
|
}),
|
|
71
76
|
Type.Object({ type: Type.Literal("log"), message: Type.String() }),
|
|
72
77
|
Type.Object({ type: Type.Literal("phase"), title: Type.String() }),
|
|
78
|
+
Type.Object({ type: Type.Literal("status"), event: statusEventSchema }),
|
|
73
79
|
Type.Object({
|
|
74
80
|
type: Type.Literal("result"),
|
|
75
81
|
cellId: Type.String({ minLength: 1 }),
|
|
@@ -89,11 +95,18 @@ const kernelToHostMessageSchema = Type.Union([
|
|
|
89
95
|
|
|
90
96
|
const bridgeMessageSchema = Type.Union([hostToKernelMessageSchema, kernelToHostMessageSchema]);
|
|
91
97
|
|
|
98
|
+
export type EvalStatusEvent = { op: string } & Record<string, unknown>;
|
|
92
99
|
export type BridgeError = Static<typeof bridgeErrorSchema>;
|
|
93
100
|
export type BridgeConnectionConfig = Static<typeof connectionConfigSchema>;
|
|
94
101
|
export type HostToKernelMessage = Static<typeof hostToKernelMessageSchema>;
|
|
95
|
-
|
|
96
|
-
|
|
102
|
+
type KernelToHostMessageSchema = Static<typeof kernelToHostMessageSchema>;
|
|
103
|
+
type BridgeMessageSchema = Static<typeof bridgeMessageSchema>;
|
|
104
|
+
export type KernelToHostMessage =
|
|
105
|
+
| Exclude<KernelToHostMessageSchema, { type: "status" }>
|
|
106
|
+
| { type: "status"; event: EvalStatusEvent };
|
|
107
|
+
export type BridgeMessage =
|
|
108
|
+
| Exclude<BridgeMessageSchema, { type: "status" }>
|
|
109
|
+
| { type: "status"; event: EvalStatusEvent };
|
|
97
110
|
|
|
98
111
|
export type BridgeDecodeErrorCode =
|
|
99
112
|
| "empty_frame"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Cross-kernel bridge names shared by preludes and host adapters. */
|
|
2
|
+
/** Canonical oh-my-pi agent bridge tool name. */
|
|
3
|
+
export const RESERVED_AGENT_TOOL = "__agent__" as const;
|
|
4
|
+
/** ADAPTATION: senpi delegates output through a reserved kernel-side tool name. */
|
|
5
|
+
export const RESERVED_OUTPUT_TOOL = "__output__" as const;
|
|
6
|
+
/** Canonical oh-my-pi eval-timeout pause operation. */
|
|
7
|
+
export const TIMEOUT_PAUSE_OP = "timeout-pause" as const;
|
|
8
|
+
/** Canonical oh-my-pi eval-timeout resume operation. */
|
|
9
|
+
export const TIMEOUT_RESUME_OP = "timeout-resume" as const;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import type { AgentToolResult } from "@code-yeongyu/senpi";
|
|
2
|
+
import { type Static, Type } from "typebox";
|
|
3
|
+
import { Check, Errors } from "typebox/value";
|
|
4
|
+
import type { EvalStatusEvent, ExecuteTool } from "../tool/types.ts";
|
|
5
|
+
|
|
6
|
+
const agentArgsSchema = Type.Object(
|
|
7
|
+
{
|
|
8
|
+
prompt: Type.String({ minLength: 1 }),
|
|
9
|
+
agent: Type.Optional(Type.String({ minLength: 1 })),
|
|
10
|
+
model: Type.Optional(Type.String({ minLength: 1 })),
|
|
11
|
+
label: Type.Optional(Type.String()),
|
|
12
|
+
schema: Type.Optional(Type.Unknown()),
|
|
13
|
+
handle: Type.Optional(Type.Boolean()),
|
|
14
|
+
isolated: Type.Optional(Type.Boolean()),
|
|
15
|
+
apply: Type.Optional(Type.Boolean()),
|
|
16
|
+
merge: Type.Optional(Type.Boolean()),
|
|
17
|
+
},
|
|
18
|
+
{ additionalProperties: false },
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const unsupportedIsolationWarning = "isolated/apply/merge unsupported (no isolation in task engine)";
|
|
22
|
+
const taskIdPattern = /\bst_[A-Za-z0-9_-]+\b/;
|
|
23
|
+
const droppedOptionNames = ["isolated", "apply", "merge"] as const;
|
|
24
|
+
|
|
25
|
+
type AgentArgs = Static<typeof agentArgsSchema>;
|
|
26
|
+
type TaskParams = {
|
|
27
|
+
readonly prompt: string;
|
|
28
|
+
readonly subagent_type?: string;
|
|
29
|
+
readonly model?: string;
|
|
30
|
+
readonly name?: string;
|
|
31
|
+
readonly run_in_background: boolean;
|
|
32
|
+
};
|
|
33
|
+
type ProgressContext = { readonly fallbackId: string; readonly warning?: string };
|
|
34
|
+
|
|
35
|
+
export type AgentExecuteTool = ExecuteTool & {
|
|
36
|
+
readonly isToolAvailable?: (name: string) => boolean;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export interface RunEvalAgentOptions {
|
|
40
|
+
readonly callId: string;
|
|
41
|
+
readonly taskToolName: string;
|
|
42
|
+
readonly executeTool: AgentExecuteTool;
|
|
43
|
+
readonly signal?: AbortSignal;
|
|
44
|
+
readonly emitStatus?: (event: EvalStatusEvent) => void;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type EvalAgentResult =
|
|
48
|
+
| { readonly text: string }
|
|
49
|
+
| { readonly text: string; readonly data: unknown }
|
|
50
|
+
| { readonly text: string; readonly parseError: string }
|
|
51
|
+
| { readonly text: string; readonly id: string; readonly handle: string };
|
|
52
|
+
|
|
53
|
+
class AgentArgumentsError extends Error {
|
|
54
|
+
readonly name = "AgentArgumentsError";
|
|
55
|
+
|
|
56
|
+
constructor(summary: string) {
|
|
57
|
+
super(`agent() received invalid arguments: ${summary}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
class AgentUnavailableError extends Error {
|
|
62
|
+
readonly name = "AgentUnavailableError";
|
|
63
|
+
|
|
64
|
+
constructor(toolName: string) {
|
|
65
|
+
super(`agent() unavailable: no "${toolName}" tool is registered in this session`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
class AgentHandleError extends Error {
|
|
70
|
+
readonly name = "AgentHandleError";
|
|
71
|
+
|
|
72
|
+
constructor() {
|
|
73
|
+
super("agent() background task result did not include a task id");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export async function runEvalAgent(args: unknown, options: RunEvalAgentOptions): Promise<EvalAgentResult> {
|
|
78
|
+
const parsed = parseAgentArgs(args);
|
|
79
|
+
const structured = Object.hasOwn(parsed, "schema");
|
|
80
|
+
const warning = droppedOptionsWarning(parsed);
|
|
81
|
+
const fallbackId = parsed.label ?? options.callId;
|
|
82
|
+
if (warning) options.emitStatus?.({ op: "agent", id: fallbackId, status: "running", warning });
|
|
83
|
+
|
|
84
|
+
// omp assertNotPlanMode intentionally dropped: senpi has no plan mode
|
|
85
|
+
// senpi-task children lose task tools, so recursion self-gates without a depth counter.
|
|
86
|
+
if (options.executeTool.isToolAvailable?.(options.taskToolName) === false) {
|
|
87
|
+
throw new AgentUnavailableError(options.taskToolName);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
let result: AgentToolResult<unknown>;
|
|
91
|
+
try {
|
|
92
|
+
result = await options.executeTool(options.taskToolName, toTaskParams(parsed, structured), {
|
|
93
|
+
...(options.signal ? { signal: options.signal } : {}),
|
|
94
|
+
...(options.emitStatus
|
|
95
|
+
? {
|
|
96
|
+
onUpdate: (update: AgentToolResult<unknown>) =>
|
|
97
|
+
options.emitStatus?.(toProgressEvent(update, { fallbackId, ...(warning ? { warning } : {}) })),
|
|
98
|
+
}
|
|
99
|
+
: {}),
|
|
100
|
+
});
|
|
101
|
+
} catch (error) {
|
|
102
|
+
if (isUnavailableToolError(error)) throw new AgentUnavailableError(options.taskToolName);
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const text = resultText(result);
|
|
107
|
+
if (parsed.handle === true) {
|
|
108
|
+
const id = resultTaskId(result, text);
|
|
109
|
+
if (!id) throw new AgentHandleError();
|
|
110
|
+
return { text, id, handle: `agent://${id}` };
|
|
111
|
+
}
|
|
112
|
+
if (!structured) return { text };
|
|
113
|
+
return parseStructuredText(text);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function parseAgentArgs(value: unknown): AgentArgs {
|
|
117
|
+
if (Check(agentArgsSchema, value)) return value;
|
|
118
|
+
const summary = Errors(agentArgsSchema, value)
|
|
119
|
+
.map((error) => `${error.instancePath || "/"} ${error.message}`)
|
|
120
|
+
.join("; ");
|
|
121
|
+
throw new AgentArgumentsError(summary || "invalid value");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function toTaskParams(args: AgentArgs, structured: boolean): TaskParams {
|
|
125
|
+
return {
|
|
126
|
+
prompt: structured
|
|
127
|
+
? `${args.prompt}\n\nRespond ONLY with JSON matching this JSON-Schema:\n${JSON.stringify(args.schema)}`
|
|
128
|
+
: args.prompt,
|
|
129
|
+
...(args.agent === undefined ? {} : { subagent_type: args.agent }),
|
|
130
|
+
...(args.model === undefined ? {} : { model: args.model }),
|
|
131
|
+
...(args.label === undefined ? {} : { name: args.label }),
|
|
132
|
+
run_in_background: args.handle === true,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function parseStructuredText(text: string): EvalAgentResult {
|
|
137
|
+
try {
|
|
138
|
+
const data: unknown = JSON.parse(text);
|
|
139
|
+
return { text, data };
|
|
140
|
+
} catch (error) {
|
|
141
|
+
if (error instanceof SyntaxError) return { text, parseError: error.message };
|
|
142
|
+
throw error;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function droppedOptionsWarning(args: AgentArgs): string | undefined {
|
|
147
|
+
return droppedOptionNames.some((name) => Object.hasOwn(args, name)) ? unsupportedIsolationWarning : undefined;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function toProgressEvent(update: AgentToolResult<unknown>, context: ProgressContext): EvalStatusEvent {
|
|
151
|
+
const details = isRecord(update.details) ? update.details : undefined;
|
|
152
|
+
const id = firstString(details, ["task_id", "taskId", "id"]) ?? context.fallbackId;
|
|
153
|
+
const status = firstString(details, ["status"]) ?? "running";
|
|
154
|
+
const agent = firstString(details, ["subagent_type", "agent"]);
|
|
155
|
+
return {
|
|
156
|
+
op: "agent",
|
|
157
|
+
id,
|
|
158
|
+
status,
|
|
159
|
+
...(agent === undefined ? {} : { agent }),
|
|
160
|
+
...(context.warning === undefined ? {} : { warning: context.warning }),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function resultText(result: AgentToolResult<unknown>): string {
|
|
165
|
+
return result.content
|
|
166
|
+
.filter((part): part is Extract<(typeof result.content)[number], { type: "text" }> => part.type === "text")
|
|
167
|
+
.map((part) => part.text)
|
|
168
|
+
.join("\n");
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function resultTaskId(result: AgentToolResult<unknown>, text: string): string | undefined {
|
|
172
|
+
const details = isRecord(result.details) ? result.details : undefined;
|
|
173
|
+
const detailId = firstString(details, ["task_id", "taskId", "id"]);
|
|
174
|
+
if (detailId) return detailId;
|
|
175
|
+
return text.match(taskIdPattern)?.[0];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function firstString(
|
|
179
|
+
record: Readonly<Record<string, unknown>> | undefined,
|
|
180
|
+
keys: readonly string[],
|
|
181
|
+
): string | undefined {
|
|
182
|
+
if (!record) return undefined;
|
|
183
|
+
for (const key of keys) {
|
|
184
|
+
const value = record[key];
|
|
185
|
+
if (typeof value === "string" && value.length > 0) return value;
|
|
186
|
+
}
|
|
187
|
+
return undefined;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function isUnavailableToolError(error: unknown): boolean {
|
|
191
|
+
if (!isRecord(error)) return false;
|
|
192
|
+
return error.code === "unknown_tool" || error.code === "inactive_tool";
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function isRecord(value: unknown): value is Readonly<Record<string, unknown>> {
|
|
196
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
197
|
+
}
|