@adastracomputing/ink 0.1.0-alpha.3 → 0.1.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.
Files changed (64) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +15 -3
  3. package/dist/audit/inclusion-receipt.d.ts +142 -0
  4. package/dist/audit/inclusion-receipt.js +496 -0
  5. package/dist/crypto/ink.d.ts +178 -0
  6. package/dist/crypto/ink.js +915 -0
  7. package/dist/crypto/keys.d.ts +42 -0
  8. package/dist/crypto/keys.js +179 -0
  9. package/dist/crypto/multi-key-verify.d.ts +29 -0
  10. package/dist/crypto/multi-key-verify.js +153 -0
  11. package/dist/crypto/sign.d.ts +17 -0
  12. package/dist/crypto/sign.js +152 -0
  13. package/dist/crypto/verify.js +1 -0
  14. package/dist/discovery/agent-card.d.ts +83 -0
  15. package/dist/discovery/agent-card.js +545 -0
  16. package/dist/index.d.ts +13 -0
  17. package/dist/index.js +16 -0
  18. package/dist/ink/checkpoint.d.ts +19 -0
  19. package/dist/ink/checkpoint.js +69 -0
  20. package/dist/ink/discovery-gating.d.ts +247 -0
  21. package/dist/ink/discovery-gating.js +94 -0
  22. package/dist/ink/handshake-budget.d.ts +90 -0
  23. package/dist/ink/handshake-budget.js +397 -0
  24. package/dist/ink/receipts.d.ts +31 -0
  25. package/dist/ink/receipts.js +89 -0
  26. package/dist/ink/transport-auth.d.ts +47 -0
  27. package/dist/ink/transport-auth.js +77 -0
  28. package/dist/middleware/ink-auth.d.ts +68 -0
  29. package/dist/middleware/ink-auth.js +214 -0
  30. package/dist/models/agent-card.d.ts +170 -0
  31. package/dist/models/agent-card.js +107 -0
  32. package/dist/models/ink-audit.d.ts +344 -0
  33. package/dist/models/ink-audit.js +167 -0
  34. package/dist/models/ink-handshake.d.ts +129 -0
  35. package/dist/models/ink-handshake.js +89 -0
  36. package/dist/models/intent.d.ts +437 -0
  37. package/dist/models/intent.js +172 -0
  38. package/dist/models/key-entry.d.ts +60 -0
  39. package/dist/models/key-entry.js +13 -0
  40. package/dist/models/profile.d.ts +61 -0
  41. package/dist/models/profile.js +24 -0
  42. package/package.json +15 -11
  43. package/specs/ink-auditability.md +2 -2
  44. package/specs/ink-containment-phase1-implementation-spec.md +1 -1
  45. package/src/audit/inclusion-receipt.ts +0 -604
  46. package/src/crypto/ink.ts +0 -1046
  47. package/src/crypto/keys.ts +0 -210
  48. package/src/crypto/multi-key-verify.ts +0 -170
  49. package/src/crypto/sign.ts +0 -155
  50. package/src/discovery/agent-card.ts +0 -508
  51. package/src/index.ts +0 -73
  52. package/src/ink/checkpoint.ts +0 -75
  53. package/src/ink/discovery-gating.ts +0 -147
  54. package/src/ink/handshake-budget.ts +0 -413
  55. package/src/ink/receipts.ts +0 -114
  56. package/src/ink/transport-auth.ts +0 -96
  57. package/src/middleware/ink-auth.ts +0 -263
  58. package/src/models/agent-card.ts +0 -63
  59. package/src/models/ink-audit.ts +0 -205
  60. package/src/models/ink-handshake.ts +0 -123
  61. package/src/models/intent.ts +0 -201
  62. package/src/models/key-entry.ts +0 -52
  63. package/src/models/profile.ts +0 -31
  64. /package/{src/crypto/verify.ts → dist/crypto/verify.d.ts} +0 -0
@@ -0,0 +1,60 @@
1
+ import { z } from "zod";
2
+ export declare const KeyStatusSchema: z.ZodEnum<{
3
+ active: "active";
4
+ retired: "retired";
5
+ revoked: "revoked";
6
+ }>;
7
+ export type KeyStatus = z.infer<typeof KeyStatusSchema>;
8
+ export declare const KeyRoleSchema: z.ZodEnum<{
9
+ signing: "signing";
10
+ encryption: "encryption";
11
+ }>;
12
+ export type KeyRole = z.infer<typeof KeyRoleSchema>;
13
+ export declare const KeyEntrySchema: z.ZodObject<{
14
+ keyId: z.ZodString;
15
+ algorithm: z.ZodEnum<{
16
+ Ed25519: "Ed25519";
17
+ X25519: "X25519";
18
+ }>;
19
+ publicKeyMultibase: z.ZodString;
20
+ status: z.ZodEnum<{
21
+ active: "active";
22
+ retired: "retired";
23
+ revoked: "revoked";
24
+ }>;
25
+ validFrom: z.ZodString;
26
+ validUntil: z.ZodOptional<z.ZodString>;
27
+ revokedAt: z.ZodOptional<z.ZodString>;
28
+ revokeReason: z.ZodOptional<z.ZodString>;
29
+ }, z.core.$strip>;
30
+ export type KeyEntry = z.infer<typeof KeyEntrySchema>;
31
+ export interface CandidateKey {
32
+ keyId: string;
33
+ publicKey: Uint8Array;
34
+ status: KeyStatus;
35
+ /** ISO 8601 timestamp the key becomes usable. Verifier rejects messages
36
+ * whose `body.timestamp` falls outside [validFrom, validUntil]. Optional
37
+ * for backward compat with legacy callers that don't track windows. */
38
+ validFrom?: string;
39
+ /** ISO 8601 timestamp the key stops being usable. Typically set when a
40
+ * key transitions to `retired`. A retired key with no validUntil keeps
41
+ * verifying indefinitely (legacy behavior); set validUntil to bound it. */
42
+ validUntil?: string;
43
+ /** ISO 8601 timestamp the key was revoked. Defensive: status === "revoked"
44
+ * already blocks verification; this field documents the moment. */
45
+ revokedAt?: string;
46
+ }
47
+ export interface StoredKey {
48
+ keyId: string;
49
+ agentId: string;
50
+ role: KeyRole;
51
+ algorithm: string;
52
+ publicKeyMultibase: string;
53
+ privateKey: Uint8Array | null;
54
+ status: KeyStatus;
55
+ validFrom: string;
56
+ validUntil: string | null;
57
+ revokedAt: string | null;
58
+ createdAt: string;
59
+ updatedAt: string;
60
+ }
@@ -0,0 +1,13 @@
1
+ import { z } from "zod";
2
+ export const KeyStatusSchema = z.enum(["active", "retired", "revoked"]);
3
+ export const KeyRoleSchema = z.enum(["signing", "encryption"]);
4
+ export const KeyEntrySchema = z.object({
5
+ keyId: z.string().min(1),
6
+ algorithm: z.enum(["Ed25519", "X25519"]),
7
+ publicKeyMultibase: z.string().startsWith("z"),
8
+ status: KeyStatusSchema,
9
+ validFrom: z.string().datetime(),
10
+ validUntil: z.string().datetime().optional(),
11
+ revokedAt: z.string().datetime().optional(),
12
+ revokeReason: z.string().optional(),
13
+ });
@@ -0,0 +1,61 @@
1
+ import { z } from "zod";
2
+ export declare const AvailabilityConfigSchema: z.ZodObject<{
3
+ timezone: z.ZodString;
4
+ meetingHours: z.ZodOptional<z.ZodString>;
5
+ responseSla: z.ZodOptional<z.ZodString>;
6
+ }, z.core.$strip>;
7
+ export declare const ProfileSnapshotSchema: z.ZodObject<{
8
+ headline: z.ZodString;
9
+ skills: z.ZodArray<z.ZodString>;
10
+ interests: z.ZodArray<z.ZodString>;
11
+ availability: z.ZodOptional<z.ZodObject<{
12
+ timezone: z.ZodString;
13
+ meetingHours: z.ZodOptional<z.ZodString>;
14
+ responseSla: z.ZodOptional<z.ZodString>;
15
+ }, z.core.$strip>>;
16
+ openTo: z.ZodArray<z.ZodString>;
17
+ }, z.core.$strip>;
18
+ export declare const ProfileSchema: z.ZodObject<{
19
+ agentId: z.ZodString;
20
+ handle: z.ZodString;
21
+ displayName: z.ZodString;
22
+ bio: z.ZodString;
23
+ snapshots: z.ZodObject<{
24
+ public: z.ZodObject<{
25
+ headline: z.ZodString;
26
+ skills: z.ZodArray<z.ZodString>;
27
+ interests: z.ZodArray<z.ZodString>;
28
+ availability: z.ZodOptional<z.ZodObject<{
29
+ timezone: z.ZodString;
30
+ meetingHours: z.ZodOptional<z.ZodString>;
31
+ responseSla: z.ZodOptional<z.ZodString>;
32
+ }, z.core.$strip>>;
33
+ openTo: z.ZodArray<z.ZodString>;
34
+ }, z.core.$strip>;
35
+ connected: z.ZodObject<{
36
+ headline: z.ZodString;
37
+ skills: z.ZodArray<z.ZodString>;
38
+ interests: z.ZodArray<z.ZodString>;
39
+ availability: z.ZodOptional<z.ZodObject<{
40
+ timezone: z.ZodString;
41
+ meetingHours: z.ZodOptional<z.ZodString>;
42
+ responseSla: z.ZodOptional<z.ZodString>;
43
+ }, z.core.$strip>>;
44
+ openTo: z.ZodArray<z.ZodString>;
45
+ }, z.core.$strip>;
46
+ custom: z.ZodRecord<z.ZodString, z.ZodObject<{
47
+ headline: z.ZodString;
48
+ skills: z.ZodArray<z.ZodString>;
49
+ interests: z.ZodArray<z.ZodString>;
50
+ availability: z.ZodOptional<z.ZodObject<{
51
+ timezone: z.ZodString;
52
+ meetingHours: z.ZodOptional<z.ZodString>;
53
+ responseSla: z.ZodOptional<z.ZodString>;
54
+ }, z.core.$strip>>;
55
+ openTo: z.ZodArray<z.ZodString>;
56
+ }, z.core.$strip>>;
57
+ }, z.core.$strip>;
58
+ }, z.core.$strip>;
59
+ export type AvailabilityConfig = z.infer<typeof AvailabilityConfigSchema>;
60
+ export type ProfileSnapshot = z.infer<typeof ProfileSnapshotSchema>;
61
+ export type Profile = z.infer<typeof ProfileSchema>;
@@ -0,0 +1,24 @@
1
+ import { z } from "zod";
2
+ export const AvailabilityConfigSchema = z.object({
3
+ timezone: z.string(),
4
+ meetingHours: z.string().optional(),
5
+ responseSla: z.string().optional(),
6
+ });
7
+ export const ProfileSnapshotSchema = z.object({
8
+ headline: z.string().max(500),
9
+ skills: z.array(z.string().max(100)).max(50),
10
+ interests: z.array(z.string().max(100)).max(50),
11
+ availability: AvailabilityConfigSchema.optional(),
12
+ openTo: z.array(z.string().max(100)).max(20),
13
+ });
14
+ export const ProfileSchema = z.object({
15
+ agentId: z.string(),
16
+ handle: z.string(),
17
+ displayName: z.string().max(200),
18
+ bio: z.string().max(2000),
19
+ snapshots: z.object({
20
+ public: ProfileSnapshotSchema,
21
+ connected: ProfileSnapshotSchema,
22
+ custom: z.record(z.string(), ProfileSnapshotSchema),
23
+ }),
24
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adastracomputing/ink",
3
- "version": "0.1.0-alpha.3",
3
+ "version": "0.1.1",
4
4
  "description": "Library and specification for the INK (Inter-agent Networking Kernel) protocol",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "author": "Ad Astra Computing Inc.",
@@ -13,24 +13,24 @@
13
13
  "url": "https://github.com/Ad-Astra-Computing/ink/issues"
14
14
  },
15
15
  "type": "module",
16
- "main": "./src/index.ts",
17
- "types": "./src/index.ts",
16
+ "main": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
18
  "exports": {
19
19
  ".": {
20
- "types": "./src/index.ts",
21
- "default": "./src/index.ts"
20
+ "types": "./dist/index.d.ts",
21
+ "default": "./dist/index.js"
22
22
  },
23
23
  "./package.json": "./package.json"
24
24
  },
25
25
  "sideEffects": false,
26
26
  "engines": {
27
- "node": ">=22"
27
+ "node": ">=24"
28
28
  },
29
29
  "bin": {
30
30
  "ink": "./bin/ink.mjs"
31
31
  },
32
32
  "files": [
33
- "src/",
33
+ "dist/",
34
34
  "bin/",
35
35
  "specs/",
36
36
  "docs/",
@@ -43,21 +43,25 @@
43
43
  "CODE_OF_CONDUCT.md"
44
44
  ],
45
45
  "scripts": {
46
+ "build": "rm -rf dist && tsc -p tsconfig.build.json",
46
47
  "test": "vitest run",
47
48
  "typecheck": "tsc --noEmit",
48
49
  "lint": "eslint src/ test/ scripts/",
49
- "check:surface": "tsx scripts/check-public-surface.ts"
50
+ "check:surface": "tsx scripts/check-public-surface.ts",
51
+ "check:pack": "./scripts/check-pack.sh",
52
+ "prepack": "npm run build",
53
+ "prepublishOnly": "npm run build"
50
54
  },
51
55
  "dependencies": {
52
56
  "@noble/curves": "^2.2.0",
53
57
  "@noble/ed25519": "^3.1.0",
54
- "@noble/hashes": "^1.8.0",
58
+ "@noble/hashes": "^2.2.0",
55
59
  "canonicalize": "^2.1.0",
56
- "zod": "^3.23.0"
60
+ "zod": "^4.4.3"
57
61
  },
58
62
  "devDependencies": {
59
63
  "@cloudflare/workers-types": "^4.20260418.1",
60
- "@types/node": "^22.0.0",
64
+ "@types/node": "^24.12.4",
61
65
  "@typescript-eslint/eslint-plugin": "^8.60.0",
62
66
  "@typescript-eslint/parser": "^8.60.0",
63
67
  "eslint": "^10.4.0",
@@ -425,7 +425,7 @@ A third-party audit service is a **INK service role**, not a standard INK agent.
425
425
  | Concern | INK Agent | Audit Service |
426
426
  |---------|-----------|--------------|
427
427
  | Identity | DID bound to a human via `agentLink` | `did:web` or `did:key`, self-sovereign, no human owner |
428
- | Discovery | `TulpaAgentEndpoint` in DID document | Advertised in subscribing agents' Agent Card `capabilities.thirdPartyAudit.services` |
428
+ | Discovery | `INKAgentEndpoint` in DID document (legacy `TulpaAgentEndpoint` also accepted during v0.1.x) | Advertised in subscribing agents' Agent Card `capabilities.thirdPartyAudit.services` |
429
429
  | Auth (inbound) | INK auth §3.3, verifies sender's `agentLink` delegation | INK auth §3.3, verifies sender's `agentLink` delegation (same as any INK endpoint) |
430
430
  | Auth (outbound) | Signs with `agentLink.signingKeyMultibase` | Signs with its own Ed25519 key (published in subscribing agents' Agent Card) |
431
431
  | Delegation proof | Required, must trace authority back to a human DID | Not applicable, the service is independently trusted by each subscribing agent |
@@ -436,7 +436,7 @@ A third-party audit service is a **INK service role**, not a standard INK agent.
436
436
 
437
437
  2. **Inbound auth is standard INK.** When agents submit events TO the service, the service verifies the submitter's identity via standard INK auth (§3.3), resolve the sender's DID, find their `agentLink`, verify the signature. The service is a normal INK recipient in this direction.
438
438
 
439
- 3. **Service DID resolution.** The service's `did:web` (or `did:key`) is resolved normally for TLS binding and key discovery, but the service does NOT need a `TulpaAgentEndpoint` service entry in its DID document. Its endpoint is provided directly in the subscribing agent's Agent Card configuration.
439
+ 3. **Service DID resolution.** The service's `did:web` (or `did:key`) is resolved normally for TLS binding and key discovery, but the service does NOT need an `INKAgentEndpoint` service entry in its DID document. Its endpoint is provided directly in the subscribing agent's Agent Card configuration.
440
440
 
441
441
  4. **No inbox, no intents.** The audit service does not accept INK intents, challenges or resolutions. It exposes only the audit-specific endpoints (`/ink/v1/audit/submit`, `/ink/v1/audit/query`).
442
442
 
@@ -182,7 +182,7 @@ When visibility is `capability_gated`, unauthenticated requests to the Agent Car
182
182
 
183
183
  ```typescript
184
184
  interface RedactedAgentCard {
185
- type: "tulpa.agent.card";
185
+ type: "ink.agent.card"; // legacy "tulpa.agent.card" MUST also be accepted during v0.1.x
186
186
  version: "1.0";
187
187
  agentId: string;
188
188
  displayName?: string;