codiedev 0.9.40 → 0.9.41
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/codie.js +18 -1
- package/dist/codieLauncher.d.ts +5 -0
- package/dist/codieLauncher.js +22 -1
- package/dist/utils.js +17 -6
- package/package.json +1 -1
package/dist/codie.js
CHANGED
|
@@ -232,9 +232,26 @@ async function main() {
|
|
|
232
232
|
OPENCODE_CONFIG_CONTENT: JSON.stringify(config),
|
|
233
233
|
};
|
|
234
234
|
const runtimeArgs = (0, codieLauncher_1.withCodieWorkingDirectory)(parsed.args, process.cwd());
|
|
235
|
-
const
|
|
235
|
+
const nonInteractiveRun = runtimeArgs[0] === "run";
|
|
236
|
+
if (nonInteractiveRun)
|
|
237
|
+
env.CODIEDEV_SECURITY_BLOCK_OUTPUT = "marker";
|
|
238
|
+
const result = (0, child_process_1.spawnSync)(runtime, runtimeArgs, {
|
|
239
|
+
stdio: nonInteractiveRun ? ["inherit", "inherit", "pipe"] : "inherit",
|
|
240
|
+
encoding: nonInteractiveRun ? "utf8" : undefined,
|
|
241
|
+
env,
|
|
242
|
+
});
|
|
236
243
|
if (result.error)
|
|
237
244
|
throw result.error;
|
|
245
|
+
if (nonInteractiveRun) {
|
|
246
|
+
const stderr = typeof result.stderr === "string" ? result.stderr : result.stderr?.toString() ?? "";
|
|
247
|
+
const blockReason = (0, codieLauncher_1.extractCodieSecurityBlock)(stderr);
|
|
248
|
+
if (blockReason) {
|
|
249
|
+
console.error(`Codie Security blocked this action:\n${blockReason}`);
|
|
250
|
+
}
|
|
251
|
+
else if (stderr) {
|
|
252
|
+
process.stderr.write(stderr);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
238
255
|
process.exitCode = result.status === null ? 1 : result.status;
|
|
239
256
|
}
|
|
240
257
|
main().catch((error) => {
|
package/dist/codieLauncher.d.ts
CHANGED
|
@@ -2,6 +2,11 @@ export interface CatalogModel {
|
|
|
2
2
|
id: string;
|
|
3
3
|
name?: string;
|
|
4
4
|
}
|
|
5
|
+
export declare const CODIE_SECURITY_BLOCK_MARKER = "__CODIEDEV_SECURITY_BLOCK__";
|
|
6
|
+
/** Extract the private adapter marker used to carry a local block reason
|
|
7
|
+
* across OpenCode's generic 500 boundary. The marker never contains prompt or
|
|
8
|
+
* tool input — only the deterministic policy reason. */
|
|
9
|
+
export declare function extractCodieSecurityBlock(stderr: string): string | undefined;
|
|
5
10
|
/**
|
|
6
11
|
* Pin non-interactive runs to the directory where `codie` was launched.
|
|
7
12
|
* OpenCode can reuse a previously-known project instance; without an explicit
|
package/dist/codieLauncher.js
CHANGED
|
@@ -42,7 +42,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
42
42
|
};
|
|
43
43
|
})();
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.HIDDEN_WORDMARK = exports.CODIEDEV_WORDMARK = exports.LEGACY_CODIEDEV_WORDMARK = exports.STOCK_WORDMARK = exports.BRAND_PLUGIN_SPEC = void 0;
|
|
45
|
+
exports.HIDDEN_WORDMARK = exports.CODIEDEV_WORDMARK = exports.LEGACY_CODIEDEV_WORDMARK = exports.STOCK_WORDMARK = exports.BRAND_PLUGIN_SPEC = exports.CODIE_SECURITY_BLOCK_MARKER = void 0;
|
|
46
|
+
exports.extractCodieSecurityBlock = extractCodieSecurityBlock;
|
|
46
47
|
exports.withCodieWorkingDirectory = withCodieWorkingDirectory;
|
|
47
48
|
exports.bareModel = bareModel;
|
|
48
49
|
exports.buildCodieConfig = buildCodieConfig;
|
|
@@ -62,6 +63,26 @@ const DEFAULT_NAMES = {
|
|
|
62
63
|
"z-ai/glm-5.2": "GLM 5.2 · Fireworks ZDR",
|
|
63
64
|
"moonshotai/kimi-k2.7-code": "Kimi K2.7 Code · Fireworks ZDR",
|
|
64
65
|
};
|
|
66
|
+
exports.CODIE_SECURITY_BLOCK_MARKER = "__CODIEDEV_SECURITY_BLOCK__";
|
|
67
|
+
/** Extract the private adapter marker used to carry a local block reason
|
|
68
|
+
* across OpenCode's generic 500 boundary. The marker never contains prompt or
|
|
69
|
+
* tool input — only the deterministic policy reason. */
|
|
70
|
+
function extractCodieSecurityBlock(stderr) {
|
|
71
|
+
for (const line of stderr.split(/\r?\n/)) {
|
|
72
|
+
const markerIndex = line.indexOf(exports.CODIE_SECURITY_BLOCK_MARKER);
|
|
73
|
+
if (markerIndex < 0)
|
|
74
|
+
continue;
|
|
75
|
+
try {
|
|
76
|
+
const parsed = JSON.parse(line.slice(markerIndex + exports.CODIE_SECURITY_BLOCK_MARKER.length));
|
|
77
|
+
if (typeof parsed?.reason === "string" && parsed.reason.trim())
|
|
78
|
+
return parsed.reason.trim();
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
// Ignore malformed or foreign stderr and preserve the original runtime error.
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
65
86
|
/**
|
|
66
87
|
* Pin non-interactive runs to the directory where `codie` was launched.
|
|
67
88
|
* OpenCode can reuse a previously-known project instance; without an explicit
|
package/dist/utils.js
CHANGED
|
@@ -1093,17 +1093,28 @@ function installOpenCodeCapturePlugin(agentSecurityEnabled = true) {
|
|
|
1093
1093
|
`}\n\n` +
|
|
1094
1094
|
`function enforceSync(invocation, payload) {\n` +
|
|
1095
1095
|
` const result = spawnSync(invocation.command, invocation.args, { input: JSON.stringify(payload), encoding: "utf8", stdio: ["pipe", "pipe", "ignore"], timeout: 1500 });\n` +
|
|
1096
|
-
` if (result.error) return;\n` +
|
|
1096
|
+
` if (result.error) return null;\n` +
|
|
1097
1097
|
` try {\n` +
|
|
1098
1098
|
` const decision = JSON.parse(result.stdout || "{}");\n` +
|
|
1099
1099
|
` const denied = decision?.decision === "block" || decision?.hookSpecificOutput?.permissionDecision === "deny";\n` +
|
|
1100
|
-
`
|
|
1100
|
+
` return denied ? (decision?.reason || decision?.hookSpecificOutput?.permissionDecisionReason || "Codie security policy blocked this action") : null;\n` +
|
|
1101
1101
|
` } catch (error) {\n` +
|
|
1102
|
-
` if (error instanceof SyntaxError) return;\n` +
|
|
1103
|
-
`
|
|
1102
|
+
` if (error instanceof SyntaxError) return null;\n` +
|
|
1103
|
+
` return null;\n` +
|
|
1104
1104
|
` }\n` +
|
|
1105
1105
|
`}\n\n` +
|
|
1106
1106
|
`export const CodiedevCapture = async ({ client, directory, worktree }) => {\n` +
|
|
1107
|
+
` const enforce = async (invocation, payload) => {\n` +
|
|
1108
|
+
` const reason = enforceSync(invocation, payload);\n` +
|
|
1109
|
+
` if (!reason) return;\n` +
|
|
1110
|
+
` try { await client.tui.showToast({ title: "Codie Security", message: reason, variant: "error", duration: 10000 }); } catch {}\n` +
|
|
1111
|
+
` if (process.env.CODIEDEV_SECURITY_BLOCK_OUTPUT === "marker") {\n` +
|
|
1112
|
+
` process.stderr.write("__CODIEDEV_SECURITY_BLOCK__" + JSON.stringify({ reason }) + "\\n");\n` +
|
|
1113
|
+
` } else {\n` +
|
|
1114
|
+
` process.stderr.write("\\nCodie Security blocked this action:\\n" + reason + "\\n");\n` +
|
|
1115
|
+
` }\n` +
|
|
1116
|
+
` throw new Error(reason);\n` +
|
|
1117
|
+
` };\n` +
|
|
1107
1118
|
` const resolveCwd = async (id, hint) => {\n` +
|
|
1108
1119
|
` if (typeof hint === "string" && hint && hint !== "/") { sessionDirectories.set(id, hint); return hint; }\n` +
|
|
1109
1120
|
` const remembered = sessionDirectories.get(id);\n` +
|
|
@@ -1129,13 +1140,13 @@ function installOpenCodeCapturePlugin(agentSecurityEnabled = true) {
|
|
|
1129
1140
|
` const id = input?.sessionID ?? input?.sessionId ?? "unknown";\n` +
|
|
1130
1141
|
` const cwd = await resolveCwd(id);\n` +
|
|
1131
1142
|
` const prompt = Array.isArray(output?.parts) ? output.parts.filter((part) => part?.type === "text").map((part) => part.text || "").join("\\n") : "";\n` +
|
|
1132
|
-
`
|
|
1143
|
+
` await enforce(PROMPT, { sessionId: id, cwd, prompt });\n` +
|
|
1133
1144
|
` },\n` +
|
|
1134
1145
|
` "tool.execute.before": async (input, output) => {\n` +
|
|
1135
1146
|
` if (!AGENT_SECURITY_ENABLED) return;\n` +
|
|
1136
1147
|
` const id = input?.sessionID ?? input?.sessionId ?? "unknown";\n` +
|
|
1137
1148
|
` const cwd = await resolveCwd(id);\n` +
|
|
1138
|
-
`
|
|
1149
|
+
` await enforce(SECURITY_PRE, { sessionId: id, cwd, toolName: input?.tool ?? "unknown", toolUseId: input?.callID, toolInput: output?.args ?? output });\n` +
|
|
1139
1150
|
` },\n` +
|
|
1140
1151
|
` "tool.execute.after": async (input, output) => {\n` +
|
|
1141
1152
|
` if (!AGENT_SECURITY_ENABLED) return;\n` +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codiedev",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.41",
|
|
4
4
|
"description": "Connect Claude Code, Codex, Cursor, OpenCode, or VS Code Copilot to Codiedev for team session capture and artifact collaboration — and run the governed Codie harness",
|
|
5
5
|
"bin": {
|
|
6
6
|
"codiedev": "dist/cli.js",
|