@clowder-ai/plugin-contract 0.1.0-beta.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 (74) hide show
  1. package/dist/codegen/generate-contract.d.ts +24 -0
  2. package/dist/codegen/generate-contract.d.ts.map +1 -0
  3. package/dist/codegen/generate-contract.js +328 -0
  4. package/dist/codegen/generate-contract.js.map +1 -0
  5. package/dist/conformance/index.d.ts +13 -0
  6. package/dist/conformance/index.d.ts.map +1 -0
  7. package/dist/conformance/index.js +13 -0
  8. package/dist/conformance/index.js.map +1 -0
  9. package/dist/conformance/runner.d.ts +18 -0
  10. package/dist/conformance/runner.d.ts.map +1 -0
  11. package/dist/conformance/runner.js +252 -0
  12. package/dist/conformance/runner.js.map +1 -0
  13. package/dist/generated/contract.generated.d.ts +282 -0
  14. package/dist/generated/contract.generated.d.ts.map +1 -0
  15. package/dist/generated/contract.generated.js +37 -0
  16. package/dist/generated/contract.generated.js.map +1 -0
  17. package/dist/index.d.ts +35 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +36 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/types/capability.d.ts +4 -0
  22. package/dist/types/capability.d.ts.map +1 -0
  23. package/dist/types/capability.js +11 -0
  24. package/dist/types/capability.js.map +1 -0
  25. package/dist/types/data-class.d.ts +3 -0
  26. package/dist/types/data-class.d.ts.map +1 -0
  27. package/dist/types/data-class.js +12 -0
  28. package/dist/types/data-class.js.map +1 -0
  29. package/dist/types/index.d.ts +5 -0
  30. package/dist/types/index.d.ts.map +1 -0
  31. package/dist/types/index.js +5 -0
  32. package/dist/types/index.js.map +1 -0
  33. package/dist/validation/index.d.ts +2 -0
  34. package/dist/validation/index.d.ts.map +1 -0
  35. package/dist/validation/index.js +2 -0
  36. package/dist/validation/index.js.map +1 -0
  37. package/dist/validation/messaging-semantic.d.ts +10 -0
  38. package/dist/validation/messaging-semantic.d.ts.map +1 -0
  39. package/dist/validation/messaging-semantic.js +99 -0
  40. package/dist/validation/messaging-semantic.js.map +1 -0
  41. package/fixtures/behavior/messaging/adversarial-invariants.json +475 -0
  42. package/fixtures/manifest/invalid/.gitkeep +0 -0
  43. package/fixtures/manifest/invalid/contract-version-leading-zero-prerelease.json +17 -0
  44. package/fixtures/manifest/invalid/contract-version-range.json +17 -0
  45. package/fixtures/manifest/invalid/ipc-empty-entrypoint.json +18 -0
  46. package/fixtures/manifest/invalid/plugin-version-leading-zero-prerelease.json +17 -0
  47. package/fixtures/manifest/invalid/plugin-version-not-semver.json +17 -0
  48. package/fixtures/manifest/invalid/semver-empty-build-metadata.json +17 -0
  49. package/fixtures/manifest/invalid/stdio-missing-entrypoint.json +17 -0
  50. package/fixtures/manifest/invalid/unknown-capability.json +19 -0
  51. package/fixtures/manifest/invalid/user-authored-lifecycle.json +24 -0
  52. package/fixtures/manifest/valid/.gitkeep +0 -0
  53. package/fixtures/manifest/valid/minimal-builtin.json +17 -0
  54. package/fixtures/manifest/valid/protocol-intrinsic-lifecycle.json +18 -0
  55. package/fixtures/manifest/valid/semver-build-metadata.json +17 -0
  56. package/fixtures/manifest/valid/stdio-entrypoint.json +18 -0
  57. package/fixtures/messaging/invalid/.gitkeep +0 -0
  58. package/fixtures/messaging/invalid/non-rfc3339-occurred-at.json +34 -0
  59. package/fixtures/messaging/invalid/non-utc-occurred-at.json +34 -0
  60. package/fixtures/messaging/invalid/raw-message-id-append.json +16 -0
  61. package/fixtures/messaging/invalid/raw-thread-id.json +28 -0
  62. package/fixtures/messaging/invalid/stale-read-with-ack-token.json +8 -0
  63. package/fixtures/messaging/invalid/system-draft-audience.json +31 -0
  64. package/fixtures/messaging/invalid/text-payload-missing-text.json +10 -0
  65. package/fixtures/messaging/invalid/untyped-root-document.json +3 -0
  66. package/fixtures/messaging/valid/.gitkeep +0 -0
  67. package/fixtures/messaging/valid/append-elements-with-handle.json +21 -0
  68. package/fixtures/messaging/valid/message-draft.json +28 -0
  69. package/fixtures/messaging/valid/root-message-draft.json +25 -0
  70. package/fixtures/messaging/valid/subscription-delivery.json +45 -0
  71. package/package.json +59 -0
  72. package/src/schemas/behavior-fixture.schema.json +370 -0
  73. package/src/schemas/manifest.schema.json +186 -0
  74. package/src/schemas/messaging.schema.json +473 -0
@@ -0,0 +1,17 @@
1
+ {
2
+ "pluginId": "dev.clowder.fixture.minimal",
3
+ "version": "0.1.0",
4
+ "contractVersion": "0.1.0",
5
+ "name": "Minimal fixture plugin",
6
+ "features": [
7
+ {
8
+ "id": "echo",
9
+ "name": "Echo",
10
+ "resources": [],
11
+ "capabilities": []
12
+ }
13
+ ],
14
+ "runtime": {
15
+ "transport": "builtin"
16
+ }
17
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "pluginId": "dev.clowder.fixture.protocol-lifecycle",
3
+ "version": "0.1.0",
4
+ "contractVersion": "0.1.0",
5
+ "name": "Protocol-intrinsic lifecycle fixture",
6
+ "description": "Lifecycle callbacks remain available as protocol baseline behavior without a grantable capability ID.",
7
+ "features": [
8
+ {
9
+ "id": "lifecycle-baseline",
10
+ "name": "Lifecycle baseline",
11
+ "resources": [],
12
+ "capabilities": []
13
+ }
14
+ ],
15
+ "runtime": {
16
+ "transport": "builtin"
17
+ }
18
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "pluginId": "dev.clowder.fixture.semver-build",
3
+ "version": "1.2.3+build.7",
4
+ "contractVersion": "0.1.0-candidate.1+sha.359d56e",
5
+ "name": "SemVer build metadata fixture",
6
+ "features": [
7
+ {
8
+ "id": "echo",
9
+ "name": "Echo",
10
+ "resources": [],
11
+ "capabilities": []
12
+ }
13
+ ],
14
+ "runtime": {
15
+ "transport": "builtin"
16
+ }
17
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "pluginId": "dev.clowder.fixture.stdio",
3
+ "version": "0.1.0",
4
+ "contractVersion": "0.1.0",
5
+ "name": "Stdio fixture plugin",
6
+ "features": [
7
+ {
8
+ "id": "echo",
9
+ "name": "Echo",
10
+ "resources": [],
11
+ "capabilities": []
12
+ }
13
+ ],
14
+ "runtime": {
15
+ "transport": "stdio",
16
+ "entrypoint": "dist/plugin.js"
17
+ }
18
+ }
File without changes
@@ -0,0 +1,34 @@
1
+ {
2
+ "_meta": {
3
+ "schemaRef": "MessageEnvelope"
4
+ },
5
+ "messageId": "message-1",
6
+ "revision": 1,
7
+ "threadId": "thread-1",
8
+ "actor": {
9
+ "kind": "plugin",
10
+ "id": "fixture-plugin"
11
+ },
12
+ "audience": {
13
+ "kind": "public"
14
+ },
15
+ "occurredAt": "not-a-date",
16
+ "payload": {
17
+ "provenance": {
18
+ "origin": {
19
+ "kind": "plugin",
20
+ "instanceId": "fixture-plugin-instance"
21
+ },
22
+ "epistemicStatus": "inference"
23
+ },
24
+ "elements": [
25
+ {
26
+ "elementId": "text-1",
27
+ "kind": "text",
28
+ "payload": {
29
+ "text": "Must be rejected"
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "_meta": {
3
+ "schemaRef": "MessageEnvelope"
4
+ },
5
+ "messageId": "message-1",
6
+ "revision": 1,
7
+ "threadId": "thread-1",
8
+ "actor": {
9
+ "kind": "plugin",
10
+ "id": "fixture-plugin"
11
+ },
12
+ "audience": {
13
+ "kind": "public"
14
+ },
15
+ "occurredAt": "2026-07-15T10:42:00+08:00",
16
+ "payload": {
17
+ "provenance": {
18
+ "origin": {
19
+ "kind": "plugin",
20
+ "instanceId": "fixture-plugin-instance"
21
+ },
22
+ "epistemicStatus": "inference"
23
+ },
24
+ "elements": [
25
+ {
26
+ "elementId": "text-1",
27
+ "kind": "text",
28
+ "payload": {
29
+ "text": "UTC must be emitted with Z"
30
+ }
31
+ }
32
+ ]
33
+ }
34
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "_meta": {
3
+ "schemaRef": "AppendElementsRequest"
4
+ },
5
+ "messageId": "raw-message-id",
6
+ "operationId": "append-operation-raw-id",
7
+ "elements": [
8
+ {
9
+ "elementId": "summary-1",
10
+ "kind": "text",
11
+ "payload": {
12
+ "text": "Must be rejected"
13
+ }
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "_meta": {
3
+ "schemaRef": "MessageDraft"
4
+ },
5
+ "address": {
6
+ "kind": "thread",
7
+ "threadId": "raw-thread-id"
8
+ },
9
+ "idempotencyKey": "fixture-send-raw-thread",
10
+ "payload": {
11
+ "provenance": {
12
+ "origin": {
13
+ "kind": "plugin",
14
+ "instanceId": "fixture-plugin-instance"
15
+ },
16
+ "epistemicStatus": "inference"
17
+ },
18
+ "elements": [
19
+ {
20
+ "elementId": "text-1",
21
+ "kind": "text",
22
+ "payload": {
23
+ "text": "Must be rejected"
24
+ }
25
+ }
26
+ ]
27
+ }
28
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "_meta": {
3
+ "schemaRef": "SubscriptionReadResponse"
4
+ },
5
+ "events": [],
6
+ "ackToken": "must-be-null-while-stale",
7
+ "stale": true
8
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "_meta": {
3
+ "schemaRef": "MessageDraft"
4
+ },
5
+ "address": {
6
+ "kind": "thread_handle",
7
+ "handle": "opaque-host-signed-thread-handle"
8
+ },
9
+ "draftAudience": {
10
+ "kind": "system"
11
+ },
12
+ "idempotencyKey": "fixture-send-system-audience",
13
+ "payload": {
14
+ "provenance": {
15
+ "origin": {
16
+ "kind": "plugin",
17
+ "instanceId": "fixture-plugin-instance"
18
+ },
19
+ "epistemicStatus": "inference"
20
+ },
21
+ "elements": [
22
+ {
23
+ "elementId": "text-1",
24
+ "kind": "text",
25
+ "payload": {
26
+ "text": "Must be rejected"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "_meta": {
3
+ "schemaRef": "MessageElement"
4
+ },
5
+ "elementId": "text-1",
6
+ "kind": "text",
7
+ "payload": {
8
+ "html": "text payloads must carry text"
9
+ }
10
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "unexpected": "the messaging root must reject arbitrary JSON"
3
+ }
File without changes
@@ -0,0 +1,21 @@
1
+ {
2
+ "_meta": {
3
+ "schemaRef": "AppendElementsRequest"
4
+ },
5
+ "handle": {
6
+ "kind": "message",
7
+ "token": "opaque-host-signed-message-handle"
8
+ },
9
+ "operationId": "append-operation-001",
10
+ "baseRevision": 1,
11
+ "elements": [
12
+ {
13
+ "elementId": "summary-1",
14
+ "kind": "text",
15
+ "payload": {
16
+ "text": "Derived summary"
17
+ },
18
+ "derivedFromElementId": "text-1"
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "_meta": {
3
+ "schemaRef": "MessageDraft"
4
+ },
5
+ "address": {
6
+ "kind": "thread_handle",
7
+ "handle": "opaque-host-signed-thread-handle"
8
+ },
9
+ "idempotencyKey": "fixture-send-001",
10
+ "payload": {
11
+ "provenance": {
12
+ "origin": {
13
+ "kind": "plugin",
14
+ "instanceId": "fixture-plugin-instance"
15
+ },
16
+ "epistemicStatus": "inference"
17
+ },
18
+ "elements": [
19
+ {
20
+ "elementId": "text-1",
21
+ "kind": "text",
22
+ "payload": {
23
+ "text": "Fixture message"
24
+ }
25
+ }
26
+ ]
27
+ }
28
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "address": {
3
+ "kind": "thread_handle",
4
+ "handle": "opaque-host-signed-thread-handle"
5
+ },
6
+ "idempotencyKey": "fixture-root-send-001",
7
+ "payload": {
8
+ "provenance": {
9
+ "origin": {
10
+ "kind": "plugin",
11
+ "instanceId": "fixture-plugin-instance"
12
+ },
13
+ "epistemicStatus": "inference"
14
+ },
15
+ "elements": [
16
+ {
17
+ "elementId": "text-1",
18
+ "kind": "text",
19
+ "payload": {
20
+ "text": "Root schema fixture"
21
+ }
22
+ }
23
+ ]
24
+ }
25
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "_meta": {
3
+ "schemaRef": "SubscriptionReadResponse"
4
+ },
5
+ "events": [
6
+ {
7
+ "eventId": "ev_pub_message-1_1",
8
+ "sequence": 1,
9
+ "type": "message.publish",
10
+ "envelope": {
11
+ "messageId": "message-1",
12
+ "revision": 1,
13
+ "threadId": "thread-1",
14
+ "actor": {
15
+ "kind": "plugin",
16
+ "id": "fixture-plugin"
17
+ },
18
+ "audience": {
19
+ "kind": "public"
20
+ },
21
+ "occurredAt": "2026-07-15T02:42:00Z",
22
+ "payload": {
23
+ "provenance": {
24
+ "origin": {
25
+ "kind": "plugin",
26
+ "instanceId": "fixture-plugin-instance"
27
+ },
28
+ "epistemicStatus": "inference"
29
+ },
30
+ "elements": [
31
+ {
32
+ "elementId": "text-1",
33
+ "kind": "text",
34
+ "payload": {
35
+ "text": "Fixture message"
36
+ }
37
+ }
38
+ ]
39
+ }
40
+ }
41
+ }
42
+ ],
43
+ "ackToken": "opaque-subscription-local-cursor",
44
+ "stale": false
45
+ }
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@clowder-ai/plugin-contract",
3
+ "version": "0.1.0-beta.1",
4
+ "private": false,
5
+ "description": "Clowder AI plugin contract — the single machine-readable truth source for plugin schema, types, capability table, and conformance fixtures (P15)",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./schemas/messaging": "./src/schemas/messaging.schema.json",
14
+ "./schemas/manifest": "./src/schemas/manifest.schema.json",
15
+ "./schemas/behavior-fixture": "./src/schemas/behavior-fixture.schema.json"
16
+ },
17
+ "main": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
19
+ "files": [
20
+ "dist",
21
+ "src/schemas",
22
+ "fixtures"
23
+ ],
24
+ "engines": {
25
+ "node": ">=20.0.0"
26
+ },
27
+ "scripts": {
28
+ "generate": "node --import tsx src/codegen/generate-contract.ts",
29
+ "generate:check": "node --import tsx src/codegen/generate-contract.ts --check",
30
+ "build": "pnpm clean && tsc -p tsconfig.build.json",
31
+ "typecheck": "tsc --noEmit",
32
+ "test": "node --import tsx --test src/**/*.test.ts",
33
+ "conformance": "node --import tsx src/conformance/runner.ts",
34
+ "lint": "tsc --noEmit",
35
+ "clean": "rm -rf dist",
36
+ "prepack": "pnpm build"
37
+ },
38
+ "devDependencies": {
39
+ "@types/node": "^20.17.0",
40
+ "ajv": "^8.17.0",
41
+ "ajv-formats": "^3.0.0",
42
+ "tsx": "^4.19.0",
43
+ "typescript": "^5.7.0"
44
+ },
45
+ "publishConfig": {
46
+ "access": "public"
47
+ },
48
+ "keywords": [
49
+ "clowder-ai",
50
+ "plugin",
51
+ "contract",
52
+ "schema"
53
+ ],
54
+ "repository": {
55
+ "type": "git",
56
+ "url": "https://github.com/zts212653/clowder-ai-plugins.git",
57
+ "directory": "packages/plugin-contract"
58
+ }
59
+ }