@cloudhal/agent-runtime 0.6.5 → 0.7.1

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.
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Which credential an agent principal works with (RFC-0044 §5 inv. 5): an API key (`keyId`) or
3
+ * an OAuth connection (`grantId`). Both are agents. Code that gives a key something of its own
4
+ * (an `auto` release approval, an elevation, an automation run) asks here instead of testing
5
+ * `keyId` alone, so a connection is never mistaken for the person behind it.
6
+ */
7
+ import type { Principal } from "./policy.js";
8
+ export type AgentCredential = {
9
+ readonly kind: "key";
10
+ readonly id: string;
11
+ } | {
12
+ readonly kind: "grant";
13
+ readonly id: string;
14
+ };
15
+ /** The remote agent's credential; `undefined` for people and the local stdio server. */
16
+ export declare function agentCredential(principal: Principal): AgentCredential | undefined;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Which credential an agent principal works with (RFC-0044 §5 inv. 5): an API key (`keyId`) or
3
+ * an OAuth connection (`grantId`). Both are agents. Code that gives a key something of its own
4
+ * (an `auto` release approval, an elevation, an automation run) asks here instead of testing
5
+ * `keyId` alone, so a connection is never mistaken for the person behind it.
6
+ */
7
+
8
+
9
+
10
+
11
+
12
+
13
+ /** The remote agent's credential; `undefined` for people and the local stdio server. */
14
+ export function agentCredential(principal ) {
15
+ if (principal.actor.kind !== "agent" || principal.local) return undefined;
16
+ if (principal.keyId) return { kind: "key", id: principal.keyId };
17
+ if (principal.grantId) return { kind: "grant", id: principal.grantId };
18
+ return undefined;
19
+ }
@@ -4,6 +4,7 @@
4
4
  */
5
5
  export * from "./approvals.js";
6
6
  export * from "./audit.js";
7
+ export * from "./credentials.js";
7
8
  export * from "./modes.js";
8
9
  export * from "./ownership.js";
9
10
  export * from "./policy.js";
package/dist/src/index.js CHANGED
@@ -4,6 +4,7 @@
4
4
  */
5
5
  export * from "./approvals.js";
6
6
  export * from "./audit.js";
7
+ export * from "./credentials.js";
7
8
  export * from "./modes.js";
8
9
  export * from "./ownership.js";
9
10
  export * from "./policy.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudhal/agent-runtime",
3
- "version": "0.6.5",
3
+ "version": "0.7.1",
4
4
  "description": "Cloudhal agent runtime: policy engine (actors, scopes, approvals), skill loader, audit log",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://cloudhal.dev",
@@ -24,8 +24,8 @@
24
24
  "README.md"
25
25
  ],
26
26
  "dependencies": {
27
- "@cloudhal/core-contracts": "0.6.5",
28
- "@cloudhal/storage": "0.6.5"
27
+ "@cloudhal/core-contracts": "0.7.1",
28
+ "@cloudhal/storage": "0.7.1"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/node": "^26.6.5",