@sweny-ai/core 0.1.146 → 0.1.148
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-env.d.ts +9 -0
- package/dist/agent-env.js +61 -0
- package/dist/cli/config-file.d.ts +1 -1
- package/dist/cli/config-file.js +1 -1
- package/dist/cli/config.js +6 -2
- package/dist/cli/run-output.js +1 -1
- package/dist/harness/agents.d.ts +1 -1
- package/dist/harness/agents.js +2 -2
- package/dist/harness/capabilities.d.ts +28 -0
- package/dist/harness/capabilities.js +40 -0
- package/dist/harness/claude-code.d.ts +2 -1
- package/dist/harness/claude-code.js +6 -3
- package/dist/harness/index.d.ts +5 -1
- package/dist/harness/index.js +4 -0
- package/dist/harness/pi.d.ts +202 -0
- package/dist/harness/pi.js +966 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/safe-outputs.d.ts +1 -1
- package/dist/safe-outputs.js +34 -5
- package/dist/skills/linear.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -31,8 +31,8 @@ export { resolveNodePermissions, buildNodePolicy } from "./node-policy.js";
|
|
|
31
31
|
export type { ResolvedPermissions } from "./node-policy.js";
|
|
32
32
|
export { applySafeOutputs, createEmitOutputTool, resolveActor, EMIT_OUTPUT_TOOL } from "./safe-outputs.js";
|
|
33
33
|
export type { SafeOutputIntent, ActorInfo, WriteStageState } from "./safe-outputs.js";
|
|
34
|
-
export { createHarness, claudeCompat, asClaude, policyGate, ClaudeCodeHarness, CodexHarness, SUPPORTED_AGENTS, } from "./harness/index.js";
|
|
35
|
-
export type { AgentHarness, HarnessCapabilities, HarnessId, HarnessInfo, HarnessRunRequest, HarnessRunResult, NodePolicy, PolicyGateResult, PolicyWrappers, ToolClass, ClaudeCodeHarnessOptions, CodexHarnessOptions, } from "./harness/index.js";
|
|
34
|
+
export { createHarness, claudeCompat, asClaude, policyGate, ClaudeCodeHarness, CodexHarness, PiHarness, SUPPORTED_AGENTS, } from "./harness/index.js";
|
|
35
|
+
export type { AgentHarness, HarnessCapabilities, HarnessId, HarnessInfo, HarnessRunRequest, HarnessRunResult, NodePolicy, PolicyGateResult, PolicyWrappers, ToolClass, ClaudeCodeHarnessOptions, CodexHarnessOptions, PiHarnessOptions, } from "./harness/index.js";
|
|
36
36
|
export { ClaudeClient, resolveAuthEnv } from "./harness/claude-code.js";
|
|
37
37
|
export type { ClaudeClientOptions, SwenyAuthMode, ResolveAuthEnvOpts } from "./harness/claude-code.js";
|
|
38
38
|
export { resolveExecutionModel } from "./model.js";
|
package/dist/index.js
CHANGED
|
@@ -30,8 +30,8 @@ export { execute, RouteEvaluationError } from "./executor.js";
|
|
|
30
30
|
// Least-privilege nodes and safe outputs (#365)
|
|
31
31
|
export { resolveNodePermissions, buildNodePolicy } from "./node-policy.js";
|
|
32
32
|
export { applySafeOutputs, createEmitOutputTool, resolveActor, EMIT_OUTPUT_TOOL } from "./safe-outputs.js";
|
|
33
|
-
// Agent harness (the seam) and its adapters: Claude Code and
|
|
34
|
-
export { createHarness, claudeCompat, asClaude, policyGate, ClaudeCodeHarness, CodexHarness, SUPPORTED_AGENTS, } from "./harness/index.js";
|
|
33
|
+
// Agent harness (the seam) and its adapters: Claude Code, Codex and pi
|
|
34
|
+
export { createHarness, claudeCompat, asClaude, policyGate, ClaudeCodeHarness, CodexHarness, PiHarness, SUPPORTED_AGENTS, } from "./harness/index.js";
|
|
35
35
|
// Claude client (back-compat: ClaudeClient is ClaudeCodeHarness, @deprecated)
|
|
36
36
|
export { ClaudeClient, resolveAuthEnv } from "./harness/claude-code.js";
|
|
37
37
|
// Execution model resolution
|
package/dist/safe-outputs.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export declare function safeOutputsInstruction(declarations: SafeOutputDeclarati
|
|
|
47
47
|
export interface ActorInfo {
|
|
48
48
|
/** GitHub login of whoever triggered the run. */
|
|
49
49
|
login?: string;
|
|
50
|
-
/**
|
|
50
|
+
/** Association verified for this login, or explicitly supplied by the trusted caller. */
|
|
51
51
|
association?: string;
|
|
52
52
|
}
|
|
53
53
|
/** Who triggered this run: an explicit override, else GitHub Actions' env and event payload. */
|
package/dist/safe-outputs.js
CHANGED
|
@@ -129,13 +129,16 @@ export function safeOutputsInstruction(declarations) {
|
|
|
129
129
|
"Requests outside these types or limits are refused. Do not claim a write happened; say what you requested.",
|
|
130
130
|
].join("\n");
|
|
131
131
|
}
|
|
132
|
-
function eventAssociation(path) {
|
|
133
|
-
if (!path)
|
|
132
|
+
function eventAssociation(path, login) {
|
|
133
|
+
if (!path || !login)
|
|
134
134
|
return undefined;
|
|
135
135
|
try {
|
|
136
136
|
const ev = JSON.parse(readFileSync(path, "utf-8"));
|
|
137
137
|
for (const key of ["comment", "review", "issue", "pull_request"]) {
|
|
138
|
-
const
|
|
138
|
+
const author = ev?.[key];
|
|
139
|
+
if (typeof author?.user?.login !== "string" || author.user.login.toLowerCase() !== login.toLowerCase())
|
|
140
|
+
continue;
|
|
141
|
+
const a = author.author_association;
|
|
139
142
|
if (typeof a === "string" && a.length > 0)
|
|
140
143
|
return a;
|
|
141
144
|
}
|
|
@@ -148,7 +151,7 @@ function eventAssociation(path) {
|
|
|
148
151
|
/** Who triggered this run: an explicit override, else GitHub Actions' env and event payload. */
|
|
149
152
|
export function resolveActor(env, override) {
|
|
150
153
|
const login = override?.login ?? env.GITHUB_ACTOR ?? undefined;
|
|
151
|
-
const association = override?.association ?? eventAssociation(env.GITHUB_EVENT_PATH);
|
|
154
|
+
const association = override?.association ?? eventAssociation(env.GITHUB_EVENT_PATH, login);
|
|
152
155
|
return { ...(login ? { login } : {}), ...(association ? { association } : {}) };
|
|
153
156
|
}
|
|
154
157
|
/** True when no trust list is declared, or the actor matches one. Unknown actor = untrusted. */
|
|
@@ -356,11 +359,37 @@ export async function applySafeOutputs(o) {
|
|
|
356
359
|
refuse("title too long", at);
|
|
357
360
|
continue;
|
|
358
361
|
}
|
|
362
|
+
// A Linear comment's issue ID does not encode or enforce its declared team.
|
|
363
|
+
// Resolve it through the configured read tool and carry its immutable ID to
|
|
364
|
+
// the write. Missing lookup support or unverifiable membership fails closed.
|
|
365
|
+
let number = intent.number;
|
|
366
|
+
if (via === "linear" && type === "comment" && target) {
|
|
367
|
+
const lookup = o.skills.get(via)?.tools.find((t) => t.name === "linear_get_issue" && t.access === "read");
|
|
368
|
+
let issue;
|
|
369
|
+
try {
|
|
370
|
+
const result = await lookup?.handler({ id: number }, { config: o.config, logger: o.logger });
|
|
371
|
+
if (result && typeof result === "object") {
|
|
372
|
+
issue = result.issue;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
catch {
|
|
376
|
+
// A lookup error cannot authorize a write.
|
|
377
|
+
}
|
|
378
|
+
if (typeof issue?.id !== "string" || !issue.id || typeof issue.team?.id !== "string") {
|
|
379
|
+
refuse("cannot verify Linear issue team", at);
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
if (issue.team.id.toLowerCase() !== target.toLowerCase()) {
|
|
383
|
+
refuse("issue outside the declared team", at);
|
|
384
|
+
continue;
|
|
385
|
+
}
|
|
386
|
+
number = issue.id;
|
|
387
|
+
}
|
|
359
388
|
const write = {
|
|
360
389
|
type,
|
|
361
390
|
via,
|
|
362
391
|
...(target ? { target } : {}),
|
|
363
|
-
...(
|
|
392
|
+
...(number !== undefined ? { number } : {}),
|
|
364
393
|
...(title ? { title } : {}),
|
|
365
394
|
...(type !== "label" ? { body } : {}),
|
|
366
395
|
...(labels ? { labels } : {}),
|
package/dist/skills/linear.js
CHANGED