@ory/claude-code 0.13.7 → 0.13.9
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/cli/main.js +7 -1
- package/dist/cli/setup.d.ts +11 -0
- package/dist/cli/setup.js +14 -0
- package/dist/handlers.js +9 -66
- package/package.json +2 -2
package/dist/cli/main.js
CHANGED
|
@@ -125,7 +125,13 @@ async function status() {
|
|
|
125
125
|
// local iteration). Run `claude plugin list` for an authoritative
|
|
126
126
|
// view of what the `claude` CLI has registered.
|
|
127
127
|
console.log("Hooks & plugin:");
|
|
128
|
-
|
|
128
|
+
// The data dir doubles as the default trace/debug-log home, so it exists
|
|
129
|
+
// after any session regardless of install path — its mere presence does
|
|
130
|
+
// NOT mean a plugin was assembled here. `isAssembledFromSource` keys off
|
|
131
|
+
// the `.claude-plugin` manifest, which only the `--from-source` path
|
|
132
|
+
// writes. Production installs delegate to the ory/claude-plugins
|
|
133
|
+
// marketplace and assemble nothing locally.
|
|
134
|
+
const assembled = (0, setup_js_1.isAssembledFromSource)(PERSISTENT_DIR);
|
|
129
135
|
console.log(` Local --from-source dir: ${assembled ? PERSISTENT_DIR : "(none — production installs use the ory/claude-plugins marketplace; run 'claude plugin list' to see registered plugins)"}`);
|
|
130
136
|
if (assembled) {
|
|
131
137
|
console.log(` Skills: ${fs.existsSync(path.join(PERSISTENT_DIR, "skills")) ? "installed" : "not installed"}`);
|
package/dist/cli/setup.d.ts
CHANGED
|
@@ -8,6 +8,17 @@
|
|
|
8
8
|
* npx ory-claude-setup --from-source # Install from the local source tree (dev only)
|
|
9
9
|
* npx ory-claude-setup --uninstall # Remove plugin
|
|
10
10
|
*/
|
|
11
|
+
/**
|
|
12
|
+
* Whether a `--from-source` plugin was assembled into `dir`.
|
|
13
|
+
*
|
|
14
|
+
* The data dir doubles as the default trace/debug-log home (`fromEnv` writes
|
|
15
|
+
* `ory-agent-trace.ndjson` / `ory-agent-debug.log` there on every session), so
|
|
16
|
+
* its mere existence does NOT indicate a local assembly — a production
|
|
17
|
+
* marketplace install that has run once already creates it. The plugin
|
|
18
|
+
* manifest (`.claude-plugin`) is written only by {@link assemblePluginDir}, so
|
|
19
|
+
* it's the reliable signal that this dir holds a from-source plugin.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isAssembledFromSource(dir: string): boolean;
|
|
11
22
|
/**
|
|
12
23
|
* Install the Ory plugin via the `claude` CLI.
|
|
13
24
|
*
|
package/dist/cli/setup.js
CHANGED
|
@@ -43,6 +43,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
43
43
|
};
|
|
44
44
|
})();
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.isAssembledFromSource = isAssembledFromSource;
|
|
46
47
|
exports.install = install;
|
|
47
48
|
exports.uninstall = uninstall;
|
|
48
49
|
const node_child_process_1 = require("node:child_process");
|
|
@@ -177,6 +178,19 @@ function assemblePluginDir(hookCommand) {
|
|
|
177
178
|
}, null, 2) + "\n");
|
|
178
179
|
return PERSISTENT_DIR;
|
|
179
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Whether a `--from-source` plugin was assembled into `dir`.
|
|
183
|
+
*
|
|
184
|
+
* The data dir doubles as the default trace/debug-log home (`fromEnv` writes
|
|
185
|
+
* `ory-agent-trace.ndjson` / `ory-agent-debug.log` there on every session), so
|
|
186
|
+
* its mere existence does NOT indicate a local assembly — a production
|
|
187
|
+
* marketplace install that has run once already creates it. The plugin
|
|
188
|
+
* manifest (`.claude-plugin`) is written only by {@link assemblePluginDir}, so
|
|
189
|
+
* it's the reliable signal that this dir holds a from-source plugin.
|
|
190
|
+
*/
|
|
191
|
+
function isAssembledFromSource(dir) {
|
|
192
|
+
return fs.existsSync(path.join(dir, ".claude-plugin"));
|
|
193
|
+
}
|
|
180
194
|
/** Remove the persistent install directory if it exists. */
|
|
181
195
|
function cleanPersistentDir() {
|
|
182
196
|
if (fs.existsSync(PERSISTENT_DIR)) {
|
package/dist/handlers.js
CHANGED
|
@@ -76,11 +76,11 @@ async function handleSessionStart(input, client, deps) {
|
|
|
76
76
|
const agentGate = deps.agentGate ?? argus_1.ensureAgentIdentity;
|
|
77
77
|
await agentGate(client, { projectUrl: (0, argus_1.resolveConfig)().projectUrl, harness: "claude-code" });
|
|
78
78
|
// Record the user→agent delegation so the audit trail captures that
|
|
79
|
-
// this user authorized this agent for this session. Best-effort
|
|
80
|
-
//
|
|
81
|
-
// and swallowed (fail-open —
|
|
82
|
-
// enforcement).
|
|
83
|
-
await
|
|
79
|
+
// this user authorized this agent for this session. Best-effort and
|
|
80
|
+
// written at most once per install: requires both principals to be
|
|
81
|
+
// populated, and any failure is logged and swallowed (fail-open —
|
|
82
|
+
// delegation tracking is for audit, not enforcement).
|
|
83
|
+
await (0, argus_1.writeUserDelegatesAgent)(client);
|
|
84
84
|
if (!decision.proceed) {
|
|
85
85
|
return { decision: "block", reason: decision.reason };
|
|
86
86
|
}
|
|
@@ -478,45 +478,11 @@ function permissionRequestFallback(reason) {
|
|
|
478
478
|
function resolveNamespace() {
|
|
479
479
|
return process.env.ORY_PERMISSION_NAMESPACE ?? "AgentTools";
|
|
480
480
|
}
|
|
481
|
-
/**
|
|
482
|
-
* Write the user→agent delegation tuple. Idempotent and fail-open:
|
|
483
|
-
* requires both principal subjects to be populated; any error (including
|
|
484
|
-
* unconfigured projectUrl, which manifests as a network_error) is logged
|
|
485
|
-
* and swallowed. The actual permission enforcement is unchanged — this
|
|
486
|
-
* tuple is purely audit-trail data.
|
|
487
|
-
*/
|
|
488
|
-
async function recordUserDelegatesAgent(client) {
|
|
489
|
-
const user = client.userPrincipal.subject;
|
|
490
|
-
const agent = client.agentPrincipal.subject;
|
|
491
|
-
if (!user || !agent) {
|
|
492
|
-
client.logger.debug("delegation.skip", {
|
|
493
|
-
reason: "missing principal",
|
|
494
|
-
hasUser: !!user,
|
|
495
|
-
hasAgent: !!agent,
|
|
496
|
-
});
|
|
497
|
-
return;
|
|
498
|
-
}
|
|
499
|
-
try {
|
|
500
|
-
await client.createRelationship({
|
|
501
|
-
namespace: resolveNamespace(),
|
|
502
|
-
object: `agent:${agent}`,
|
|
503
|
-
relation: "delegate",
|
|
504
|
-
subjectId: `user:${user}`,
|
|
505
|
-
}, { spanAttributes: { delegation: "user-to-agent" } });
|
|
506
|
-
}
|
|
507
|
-
catch (err) {
|
|
508
|
-
const oryErr = err;
|
|
509
|
-
client.logger.warn("delegation.user_to_agent.failed", {
|
|
510
|
-
code: oryErr.code,
|
|
511
|
-
message: oryErr.message,
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
481
|
/**
|
|
516
482
|
* Register an OAuth2 identity for a sub-agent and write the
|
|
517
|
-
* `agent → subagent` delegation tuple. Fail-open and
|
|
518
|
-
*
|
|
519
|
-
*
|
|
483
|
+
* `agent → subagent` delegation tuple. Fail-open and written at most once
|
|
484
|
+
* per install, so the multiple call paths (SubagentStart event + Task-tool
|
|
485
|
+
* fallback) won't duplicate state.
|
|
520
486
|
*/
|
|
521
487
|
async function registerSubAgent(subAgentType, client, deps) {
|
|
522
488
|
const subAgentGate = deps.subAgentGate ?? argus_1.ensureSubAgentIdentity;
|
|
@@ -537,30 +503,7 @@ async function registerSubAgent(subAgentType, client, deps) {
|
|
|
537
503
|
}
|
|
538
504
|
if (identity.kind !== "dynamic" || !identity.subject)
|
|
539
505
|
return;
|
|
540
|
-
|
|
541
|
-
if (!agent) {
|
|
542
|
-
client.logger.debug("delegation.skip", {
|
|
543
|
-
reason: "agent principal not populated",
|
|
544
|
-
subAgentType,
|
|
545
|
-
});
|
|
546
|
-
return;
|
|
547
|
-
}
|
|
548
|
-
try {
|
|
549
|
-
await client.createRelationship({
|
|
550
|
-
namespace: resolveNamespace(),
|
|
551
|
-
object: `subagent:${identity.subject}`,
|
|
552
|
-
relation: "delegate",
|
|
553
|
-
subjectId: `agent:${agent}`,
|
|
554
|
-
}, { spanAttributes: { delegation: "agent-to-subagent", subAgentType } });
|
|
555
|
-
}
|
|
556
|
-
catch (err) {
|
|
557
|
-
const oryErr = err;
|
|
558
|
-
client.logger.warn("delegation.agent_to_subagent.failed", {
|
|
559
|
-
subAgentType,
|
|
560
|
-
code: oryErr.code,
|
|
561
|
-
message: oryErr.message,
|
|
562
|
-
});
|
|
563
|
-
}
|
|
506
|
+
await (0, argus_1.writeAgentDelegatesSubagent)(client, identity.subject, subAgentType);
|
|
564
507
|
}
|
|
565
508
|
/**
|
|
566
509
|
* Legacy fallback for older Claude Code versions that don't fire
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ory/claude-code",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.9",
|
|
4
4
|
"description": "Ory plugin for Claude Code: scaffolding skills, a local Ory instance, and authentication, authorization, and audit for every tool call",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/ory/claude-plugins/tree/master/plugins/ory-agent-plugin",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
],
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"reo-census": "^1.2.8",
|
|
79
|
-
"@ory/argus": "0.13.
|
|
79
|
+
"@ory/argus": "0.13.9"
|
|
80
80
|
},
|
|
81
81
|
"engines": {
|
|
82
82
|
"node": ">=22"
|