@ikenga/contract 0.13.0 → 0.14.0

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,42 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Identity of the human operating the shell, injected into `hostContext` at
4
+ * the AppBridge handshake (`buildHostContext()` in
5
+ * `shell/src/lib/pkg/host-context.ts`, cast in alongside `royaltiSuite` /
6
+ * `supabase` / `secrets`). Host-injected, not pkg-declared — there is no
7
+ * manifest capability gate for it.
8
+ *
9
+ * Currently sourced from the free-text onboarding `userName` (shell store),
10
+ * falling back to the OS username when unset. Treat `id` as a stable
11
+ * display label, NOT a durable account id or an auth subject.
12
+ */
13
+ export declare const OperatorIdentitySchema: z.ZodObject<{
14
+ /** Stable-enough identifier for the operator (today: `userName` or an
15
+ * OS-username fallback). Not an auth subject. */
16
+ id: z.ZodString;
17
+ /** Human-friendly label, when it differs from `id`. */
18
+ displayName: z.ZodOptional<z.ZodString>;
19
+ }, "strict", z.ZodTypeAny, {
20
+ id: string;
21
+ displayName?: string | undefined;
22
+ }, {
23
+ id: string;
24
+ displayName?: string | undefined;
25
+ }>;
26
+ export type OperatorIdentity = z.infer<typeof OperatorIdentitySchema>;
27
+ /**
28
+ * hostContext fields Ikenga casts onto the MCP-UI-Apps `McpUiHostContext`
29
+ * base type (imported from `@modelcontextprotocol/ext-apps/app-bridge` —
30
+ * this package does not redefine that base type, only the Ikenga-specific
31
+ * extensions layered onto it).
32
+ *
33
+ * `operator` is OPTIONAL: older shells and the initial handshake before the
34
+ * onboarding step has run won't send it. A consumer MUST treat an absent
35
+ * `operator` as an UNKNOWN operator and fail SAFE — e.g. use a confirming
36
+ * `ux_mode` ('confirm') rather than auto-approving an operator-scoped
37
+ * action — never assume a default identity.
38
+ */
39
+ export interface IkengaHostContextExtensions {
40
+ operator?: OperatorIdentity;
41
+ }
42
+ //# sourceMappingURL=host-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-context.d.ts","sourceRoot":"","sources":["../src/host-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB;IAE/B;sDACkD;;IAElD,uDAAuD;;;;;;;;EAGhD,CAAC;AACZ,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CAC7B"}
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Identity of the human operating the shell, injected into `hostContext` at
4
+ * the AppBridge handshake (`buildHostContext()` in
5
+ * `shell/src/lib/pkg/host-context.ts`, cast in alongside `royaltiSuite` /
6
+ * `supabase` / `secrets`). Host-injected, not pkg-declared — there is no
7
+ * manifest capability gate for it.
8
+ *
9
+ * Currently sourced from the free-text onboarding `userName` (shell store),
10
+ * falling back to the OS username when unset. Treat `id` as a stable
11
+ * display label, NOT a durable account id or an auth subject.
12
+ */
13
+ export const OperatorIdentitySchema = z
14
+ .object({
15
+ /** Stable-enough identifier for the operator (today: `userName` or an
16
+ * OS-username fallback). Not an auth subject. */
17
+ id: z.string(),
18
+ /** Human-friendly label, when it differs from `id`. */
19
+ displayName: z.string().optional(),
20
+ })
21
+ .strict();
22
+ //# sourceMappingURL=host-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-context.js","sourceRoot":"","sources":["../src/host-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC;KACpC,MAAM,CAAC;IACN;sDACkD;IAClD,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,uDAAuD;IACvD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC;KACD,MAAM,EAAE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export * from './browser.js';
10
10
  export * from './pa-actions.js';
11
11
  export * from './window.js';
12
12
  export * from './action-frontmatter.js';
13
+ export * from './host-context.js';
13
14
  /** This package's own version. */
14
15
  export declare const CONTRACT_PACKAGE_VERSION: "0.5.0";
15
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AAExC,kCAAkC;AAClC,eAAO,MAAM,wBAAwB,EAAG,OAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAElC,kCAAkC;AAClC,eAAO,MAAM,wBAAwB,EAAG,OAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -10,6 +10,7 @@ export * from './browser.js';
10
10
  export * from './pa-actions.js';
11
11
  export * from './window.js';
12
12
  export * from './action-frontmatter.js';
13
+ export * from './host-context.js';
13
14
  /** This package's own version. */
14
15
  export const CONTRACT_PACKAGE_VERSION = '0.5.0';
15
16
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AAExC,kCAAkC;AAClC,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAElC,kCAAkC;AAClC,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAgB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikenga/contract",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "Shared contract for the Ikenga pkg system: manifest schema, RPC types, Engine interface, capability scopes.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -63,6 +63,10 @@
63
63
  "./action-frontmatter": {
64
64
  "types": "./dist/action-frontmatter.d.ts",
65
65
  "import": "./dist/action-frontmatter.js"
66
+ },
67
+ "./host-context": {
68
+ "types": "./dist/host-context.d.ts",
69
+ "import": "./dist/host-context.js"
66
70
  }
67
71
  },
68
72
  "files": [
@@ -0,0 +1,24 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+
4
+ import { OperatorIdentitySchema } from './host-context.js';
5
+
6
+ test('OperatorIdentity: id-only parses, displayName optional', () => {
7
+ const o = OperatorIdentitySchema.parse({ id: 'nedjamez' });
8
+ assert.equal(o.id, 'nedjamez');
9
+ assert.equal(o.displayName, undefined);
10
+ });
11
+
12
+ test('OperatorIdentity: full shape parses', () => {
13
+ const o = OperatorIdentitySchema.parse({ id: 'nedjamez', displayName: 'Chinedum' });
14
+ assert.equal(o.id, 'nedjamez');
15
+ assert.equal(o.displayName, 'Chinedum');
16
+ });
17
+
18
+ test('OperatorIdentity: rejects unknown field (.strict)', () => {
19
+ assert.throws(() => OperatorIdentitySchema.parse({ id: 'nedjamez', bogus: true }));
20
+ });
21
+
22
+ test('OperatorIdentity: rejects missing id', () => {
23
+ assert.throws(() => OperatorIdentitySchema.parse({ displayName: 'Chinedum' }));
24
+ });
@@ -0,0 +1,39 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Identity of the human operating the shell, injected into `hostContext` at
5
+ * the AppBridge handshake (`buildHostContext()` in
6
+ * `shell/src/lib/pkg/host-context.ts`, cast in alongside `royaltiSuite` /
7
+ * `supabase` / `secrets`). Host-injected, not pkg-declared — there is no
8
+ * manifest capability gate for it.
9
+ *
10
+ * Currently sourced from the free-text onboarding `userName` (shell store),
11
+ * falling back to the OS username when unset. Treat `id` as a stable
12
+ * display label, NOT a durable account id or an auth subject.
13
+ */
14
+ export const OperatorIdentitySchema = z
15
+ .object({
16
+ /** Stable-enough identifier for the operator (today: `userName` or an
17
+ * OS-username fallback). Not an auth subject. */
18
+ id: z.string(),
19
+ /** Human-friendly label, when it differs from `id`. */
20
+ displayName: z.string().optional(),
21
+ })
22
+ .strict();
23
+ export type OperatorIdentity = z.infer<typeof OperatorIdentitySchema>;
24
+
25
+ /**
26
+ * hostContext fields Ikenga casts onto the MCP-UI-Apps `McpUiHostContext`
27
+ * base type (imported from `@modelcontextprotocol/ext-apps/app-bridge` —
28
+ * this package does not redefine that base type, only the Ikenga-specific
29
+ * extensions layered onto it).
30
+ *
31
+ * `operator` is OPTIONAL: older shells and the initial handshake before the
32
+ * onboarding step has run won't send it. A consumer MUST treat an absent
33
+ * `operator` as an UNKNOWN operator and fail SAFE — e.g. use a confirming
34
+ * `ux_mode` ('confirm') rather than auto-approving an operator-scoped
35
+ * action — never assume a default identity.
36
+ */
37
+ export interface IkengaHostContextExtensions {
38
+ operator?: OperatorIdentity;
39
+ }
package/src/index.ts CHANGED
@@ -10,6 +10,7 @@ export * from './browser.js';
10
10
  export * from './pa-actions.js';
11
11
  export * from './window.js';
12
12
  export * from './action-frontmatter.js';
13
+ export * from './host-context.js';
13
14
 
14
15
  /** This package's own version. */
15
16
  export const CONTRACT_PACKAGE_VERSION = '0.5.0' as const;