@theway-ai/plugin-sdk 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.
@@ -0,0 +1,135 @@
1
+ {
2
+ "$defs": {
3
+ "ExtensionDiagnosticCode": {
4
+ "enum": [
5
+ "manifest_invalid",
6
+ "shadowed",
7
+ "trust_required",
8
+ "permission_denied",
9
+ "load_failed",
10
+ "hook_failed",
11
+ "hook_timed_out",
12
+ "cancelled",
13
+ "resource_limit",
14
+ "circuit_opened",
15
+ "unloaded",
16
+ "reload_pending",
17
+ "state_migration_failed",
18
+ "persistence_failed",
19
+ "queue_overflow",
20
+ "lifecycle_status",
21
+ "contract_violation"
22
+ ],
23
+ "type": "string"
24
+ },
25
+ "ExtensionDiagnosticSeverity": {
26
+ "enum": [
27
+ "info",
28
+ "warning",
29
+ "error"
30
+ ],
31
+ "type": "string"
32
+ },
33
+ "ExtensionLifecycleEvent": {
34
+ "description": "Stable public lifecycle names. Internal runtime events are translated into\nthese values rather than serialized directly.",
35
+ "enum": [
36
+ "extension_load",
37
+ "session_start",
38
+ "input",
39
+ "before_session_switch",
40
+ "session_switched",
41
+ "before_session_fork",
42
+ "session_forked",
43
+ "before_model_selection",
44
+ "model_selected",
45
+ "before_run",
46
+ "run_started",
47
+ "turn_started",
48
+ "context",
49
+ "before_model_request",
50
+ "before_provider_request_headers",
51
+ "before_provider_request_raw",
52
+ "provider_response",
53
+ "provider_request_failed",
54
+ "message_start",
55
+ "message_update",
56
+ "message_end",
57
+ "tool_call",
58
+ "tool_execution_start",
59
+ "tool_execution_update",
60
+ "tool_execution_end",
61
+ "tool_result",
62
+ "turn_completed",
63
+ "run_ended",
64
+ "run_error",
65
+ "run_settled",
66
+ "before_compaction",
67
+ "compaction_succeeded",
68
+ "compaction_failed",
69
+ "session_shutdown",
70
+ "extension_unload"
71
+ ],
72
+ "type": "string"
73
+ }
74
+ },
75
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
76
+ "additionalProperties": false,
77
+ "description": "Structured diagnostic. Sensitive detail values are discarded when added;\nserialization exposes only their field names in `redactedFields`.",
78
+ "properties": {
79
+ "code": {
80
+ "$ref": "#/$defs/ExtensionDiagnosticCode"
81
+ },
82
+ "details": {
83
+ "additionalProperties": true,
84
+ "type": "object"
85
+ },
86
+ "event": {
87
+ "anyOf": [
88
+ {
89
+ "$ref": "#/$defs/ExtensionLifecycleEvent"
90
+ },
91
+ {
92
+ "type": "null"
93
+ }
94
+ ]
95
+ },
96
+ "extensionId": {
97
+ "type": "string"
98
+ },
99
+ "message": {
100
+ "type": "string"
101
+ },
102
+ "redactedFields": {
103
+ "items": {
104
+ "type": "string"
105
+ },
106
+ "type": "array",
107
+ "uniqueItems": true
108
+ },
109
+ "sequence": {
110
+ "format": "uint64",
111
+ "minimum": 0,
112
+ "type": [
113
+ "integer",
114
+ "null"
115
+ ]
116
+ },
117
+ "sessionId": {
118
+ "type": [
119
+ "string",
120
+ "null"
121
+ ]
122
+ },
123
+ "severity": {
124
+ "$ref": "#/$defs/ExtensionDiagnosticSeverity"
125
+ }
126
+ },
127
+ "required": [
128
+ "extensionId",
129
+ "code",
130
+ "severity",
131
+ "message"
132
+ ],
133
+ "title": "ExtensionDiagnostic",
134
+ "type": "object"
135
+ }
@@ -0,0 +1,169 @@
1
+ {
2
+ "$defs": {
3
+ "ExtensionDurableEntryPayload": {
4
+ "description": "Domain payload persisted inside an opaque extension session entry.",
5
+ "oneOf": [
6
+ {
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "key": {
10
+ "type": "string"
11
+ },
12
+ "kind": {
13
+ "const": "state_mutation",
14
+ "type": "string"
15
+ },
16
+ "mutation": {
17
+ "$ref": "#/$defs/ExtensionStateMutation"
18
+ }
19
+ },
20
+ "required": [
21
+ "kind",
22
+ "key",
23
+ "mutation"
24
+ ],
25
+ "type": "object"
26
+ },
27
+ {
28
+ "additionalProperties": false,
29
+ "properties": {
30
+ "customType": {
31
+ "type": "string"
32
+ },
33
+ "eventId": {
34
+ "type": "string"
35
+ },
36
+ "kind": {
37
+ "const": "custom_event",
38
+ "type": "string"
39
+ },
40
+ "payload": true
41
+ },
42
+ "required": [
43
+ "kind",
44
+ "eventId",
45
+ "customType",
46
+ "payload"
47
+ ],
48
+ "type": "object"
49
+ },
50
+ {
51
+ "additionalProperties": false,
52
+ "properties": {
53
+ "content": true,
54
+ "contextId": {
55
+ "type": "string"
56
+ },
57
+ "kind": {
58
+ "const": "model_context",
59
+ "type": "string"
60
+ },
61
+ "placement": {
62
+ "$ref": "#/$defs/ExtensionModelContextPlacement"
63
+ }
64
+ },
65
+ "required": [
66
+ "kind",
67
+ "contextId",
68
+ "placement",
69
+ "content"
70
+ ],
71
+ "type": "object"
72
+ },
73
+ {
74
+ "additionalProperties": false,
75
+ "properties": {
76
+ "fromSchemaVersion": {
77
+ "format": "uint32",
78
+ "minimum": 0,
79
+ "type": "integer"
80
+ },
81
+ "kind": {
82
+ "const": "state_migration",
83
+ "type": "string"
84
+ },
85
+ "toSchemaVersion": {
86
+ "format": "uint32",
87
+ "minimum": 0,
88
+ "type": "integer"
89
+ }
90
+ },
91
+ "required": [
92
+ "kind",
93
+ "fromSchemaVersion",
94
+ "toSchemaVersion"
95
+ ],
96
+ "type": "object"
97
+ }
98
+ ]
99
+ },
100
+ "ExtensionModelContextPlacement": {
101
+ "enum": [
102
+ "system_prompt_section",
103
+ "message"
104
+ ],
105
+ "type": "string"
106
+ },
107
+ "ExtensionStateMutation": {
108
+ "oneOf": [
109
+ {
110
+ "additionalProperties": false,
111
+ "properties": {
112
+ "operation": {
113
+ "const": "set",
114
+ "type": "string"
115
+ },
116
+ "value": true
117
+ },
118
+ "required": [
119
+ "operation",
120
+ "value"
121
+ ],
122
+ "type": "object"
123
+ },
124
+ {
125
+ "additionalProperties": false,
126
+ "properties": {
127
+ "operation": {
128
+ "const": "delete",
129
+ "type": "string"
130
+ }
131
+ },
132
+ "required": [
133
+ "operation"
134
+ ],
135
+ "type": "object"
136
+ }
137
+ ]
138
+ }
139
+ },
140
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
141
+ "additionalProperties": false,
142
+ "description": "Extension-owned entry stored on the active session branch. The\nsurrounding session record supplies append identity, parent, and timestamp.",
143
+ "properties": {
144
+ "entry": {
145
+ "$ref": "#/$defs/ExtensionDurableEntryPayload"
146
+ },
147
+ "extensionId": {
148
+ "type": "string"
149
+ },
150
+ "originSequence": {
151
+ "format": "uint64",
152
+ "minimum": 0,
153
+ "type": "integer"
154
+ },
155
+ "stateSchemaVersion": {
156
+ "format": "uint32",
157
+ "minimum": 0,
158
+ "type": "integer"
159
+ }
160
+ },
161
+ "required": [
162
+ "extensionId",
163
+ "stateSchemaVersion",
164
+ "originSequence",
165
+ "entry"
166
+ ],
167
+ "title": "ExtensionDurableEntry",
168
+ "type": "object"
169
+ }
@@ -0,0 +1,182 @@
1
+ {
2
+ "$defs": {
3
+ "ExtensionCancellationContext": {
4
+ "description": "Cancellation state and host deadline exposed to a hook invocation. The\nvalue carries no cancellation handle or runtime object.",
5
+ "properties": {
6
+ "cancelled": {
7
+ "default": false,
8
+ "type": "boolean"
9
+ },
10
+ "deadlineUnixMs": {
11
+ "format": "uint64",
12
+ "minimum": 0,
13
+ "type": [
14
+ "integer",
15
+ "null"
16
+ ]
17
+ }
18
+ },
19
+ "type": "object"
20
+ },
21
+ "ExtensionEventContext": {
22
+ "description": "Fields shared by every lifecycle event.",
23
+ "properties": {
24
+ "cancellation": {
25
+ "$ref": "#/$defs/ExtensionCancellationContext",
26
+ "default": {
27
+ "cancelled": false
28
+ }
29
+ },
30
+ "cwd": {
31
+ "type": "string"
32
+ },
33
+ "extensionId": {
34
+ "type": "string"
35
+ },
36
+ "hasInteractiveClient": {
37
+ "default": false,
38
+ "type": "boolean"
39
+ },
40
+ "model": {
41
+ "anyOf": [
42
+ {
43
+ "$ref": "#/$defs/ExtensionModelRef"
44
+ },
45
+ {
46
+ "type": "null"
47
+ }
48
+ ]
49
+ },
50
+ "scope": {
51
+ "$ref": "#/$defs/ExtensionScopeIds",
52
+ "default": {}
53
+ },
54
+ "sequence": {
55
+ "format": "uint64",
56
+ "minimum": 0,
57
+ "type": "integer"
58
+ },
59
+ "sessionId": {
60
+ "type": "string"
61
+ }
62
+ },
63
+ "required": [
64
+ "extensionId",
65
+ "sessionId",
66
+ "cwd",
67
+ "sequence"
68
+ ],
69
+ "type": "object"
70
+ },
71
+ "ExtensionLifecycleEvent": {
72
+ "description": "Stable public lifecycle names. Internal runtime events are translated into\nthese values rather than serialized directly.",
73
+ "enum": [
74
+ "extension_load",
75
+ "session_start",
76
+ "input",
77
+ "before_session_switch",
78
+ "session_switched",
79
+ "before_session_fork",
80
+ "session_forked",
81
+ "before_model_selection",
82
+ "model_selected",
83
+ "before_run",
84
+ "run_started",
85
+ "turn_started",
86
+ "context",
87
+ "before_model_request",
88
+ "before_provider_request_headers",
89
+ "before_provider_request_raw",
90
+ "provider_response",
91
+ "provider_request_failed",
92
+ "message_start",
93
+ "message_update",
94
+ "message_end",
95
+ "tool_call",
96
+ "tool_execution_start",
97
+ "tool_execution_update",
98
+ "tool_execution_end",
99
+ "tool_result",
100
+ "turn_completed",
101
+ "run_ended",
102
+ "run_error",
103
+ "run_settled",
104
+ "before_compaction",
105
+ "compaction_succeeded",
106
+ "compaction_failed",
107
+ "session_shutdown",
108
+ "extension_unload"
109
+ ],
110
+ "type": "string"
111
+ },
112
+ "ExtensionModelRef": {
113
+ "properties": {
114
+ "model": {
115
+ "type": "string"
116
+ },
117
+ "provider": {
118
+ "type": "string"
119
+ }
120
+ },
121
+ "required": [
122
+ "provider",
123
+ "model"
124
+ ],
125
+ "type": "object"
126
+ },
127
+ "ExtensionScopeIds": {
128
+ "description": "Correlation identifiers present only when the event belongs to that scope.",
129
+ "properties": {
130
+ "messageId": {
131
+ "type": [
132
+ "string",
133
+ "null"
134
+ ]
135
+ },
136
+ "requestId": {
137
+ "type": [
138
+ "string",
139
+ "null"
140
+ ]
141
+ },
142
+ "runId": {
143
+ "type": [
144
+ "string",
145
+ "null"
146
+ ]
147
+ },
148
+ "toolCallId": {
149
+ "type": [
150
+ "string",
151
+ "null"
152
+ ]
153
+ },
154
+ "turnId": {
155
+ "type": [
156
+ "string",
157
+ "null"
158
+ ]
159
+ }
160
+ },
161
+ "type": "object"
162
+ }
163
+ },
164
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
165
+ "description": "Engine-neutral event delivered to one extension instance.",
166
+ "properties": {
167
+ "context": {
168
+ "$ref": "#/$defs/ExtensionEventContext"
169
+ },
170
+ "event": {
171
+ "$ref": "#/$defs/ExtensionLifecycleEvent"
172
+ },
173
+ "payload": true
174
+ },
175
+ "required": [
176
+ "event",
177
+ "context",
178
+ "payload"
179
+ ],
180
+ "title": "ExtensionEventEnvelope",
181
+ "type": "object"
182
+ }
@@ -0,0 +1,138 @@
1
+ {
2
+ "$defs": {
3
+ "ExtensionActionKind": {
4
+ "description": "Stable action categories. Complex payloads stay JSON-compatible at the ABI\nboundary and are decoded into domain-specific DTOs before application.",
5
+ "enum": [
6
+ "replace_input",
7
+ "patch_run_context",
8
+ "replace_context",
9
+ "replace_model_request",
10
+ "replace_provider_headers",
11
+ "replace_provider_payload",
12
+ "replace_message",
13
+ "replace_tool_result",
14
+ "set_state",
15
+ "delete_state",
16
+ "append_custom_event",
17
+ "append_model_context",
18
+ "emit_command_outcome",
19
+ "enqueue_follow_up",
20
+ "emit_diagnostic",
21
+ "register_effect",
22
+ "dispose_effect"
23
+ ],
24
+ "type": "string"
25
+ },
26
+ "ExtensionDeliveryPolicy": {
27
+ "enum": [
28
+ "inline",
29
+ "bounded_coalescing"
30
+ ],
31
+ "type": "string"
32
+ },
33
+ "ExtensionHookClass": {
34
+ "description": "Semantic class assigned to every public hook.",
35
+ "enum": [
36
+ "observe",
37
+ "transform",
38
+ "gate",
39
+ "register"
40
+ ],
41
+ "type": "string"
42
+ },
43
+ "ExtensionHookDeadline": {
44
+ "enum": [
45
+ "fast",
46
+ "standard",
47
+ "long"
48
+ ],
49
+ "type": "string"
50
+ },
51
+ "ExtensionHookFailurePolicy": {
52
+ "enum": [
53
+ "continue",
54
+ "keep_last_value",
55
+ "deny",
56
+ "reject_registration"
57
+ ],
58
+ "type": "string"
59
+ },
60
+ "ExtensionLifecycleEvent": {
61
+ "description": "Stable public lifecycle names. Internal runtime events are translated into\nthese values rather than serialized directly.",
62
+ "enum": [
63
+ "extension_load",
64
+ "session_start",
65
+ "input",
66
+ "before_session_switch",
67
+ "session_switched",
68
+ "before_session_fork",
69
+ "session_forked",
70
+ "before_model_selection",
71
+ "model_selected",
72
+ "before_run",
73
+ "run_started",
74
+ "turn_started",
75
+ "context",
76
+ "before_model_request",
77
+ "before_provider_request_headers",
78
+ "before_provider_request_raw",
79
+ "provider_response",
80
+ "provider_request_failed",
81
+ "message_start",
82
+ "message_update",
83
+ "message_end",
84
+ "tool_call",
85
+ "tool_execution_start",
86
+ "tool_execution_update",
87
+ "tool_execution_end",
88
+ "tool_result",
89
+ "turn_completed",
90
+ "run_ended",
91
+ "run_error",
92
+ "run_settled",
93
+ "before_compaction",
94
+ "compaction_succeeded",
95
+ "compaction_failed",
96
+ "session_shutdown",
97
+ "extension_unload"
98
+ ],
99
+ "type": "string"
100
+ }
101
+ },
102
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
103
+ "additionalProperties": false,
104
+ "description": "Public metadata for one event/class pair.",
105
+ "properties": {
106
+ "allowedActions": {
107
+ "items": {
108
+ "$ref": "#/$defs/ExtensionActionKind"
109
+ },
110
+ "type": "array"
111
+ },
112
+ "class": {
113
+ "$ref": "#/$defs/ExtensionHookClass"
114
+ },
115
+ "deadline": {
116
+ "$ref": "#/$defs/ExtensionHookDeadline"
117
+ },
118
+ "delivery": {
119
+ "$ref": "#/$defs/ExtensionDeliveryPolicy"
120
+ },
121
+ "event": {
122
+ "$ref": "#/$defs/ExtensionLifecycleEvent"
123
+ },
124
+ "failure": {
125
+ "$ref": "#/$defs/ExtensionHookFailurePolicy"
126
+ }
127
+ },
128
+ "required": [
129
+ "event",
130
+ "class",
131
+ "allowedActions",
132
+ "deadline",
133
+ "delivery",
134
+ "failure"
135
+ ],
136
+ "title": "ExtensionHookContract",
137
+ "type": "object"
138
+ }
@@ -0,0 +1,88 @@
1
+ {
2
+ "$defs": {
3
+ "ExtensionPermission": {
4
+ "oneOf": [
5
+ {
6
+ "enum": [
7
+ "session.write",
8
+ "tools.register",
9
+ "tools.override",
10
+ "commands.register",
11
+ "providers.register",
12
+ "client.contribute",
13
+ "workspace.read",
14
+ "workspace.write",
15
+ "process.spawn",
16
+ "network.connect",
17
+ "provider.raw"
18
+ ]
19
+ },
20
+ {
21
+ "pattern": "^secrets\\.read:[A-Za-z0-9](?:[A-Za-z0-9._-]{0,126}[A-Za-z0-9])?$",
22
+ "type": "string"
23
+ }
24
+ ]
25
+ },
26
+ "ExtensionScope": {
27
+ "description": "Lifetime boundary for extension instances and their owned effects.",
28
+ "enum": [
29
+ "process",
30
+ "session",
31
+ "run",
32
+ "request"
33
+ ],
34
+ "type": "string"
35
+ }
36
+ },
37
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
38
+ "additionalProperties": false,
39
+ "description": "Strict on-disk package manifest for a runtime extension.",
40
+ "properties": {
41
+ "entry": {
42
+ "type": "string"
43
+ },
44
+ "id": {
45
+ "type": "string"
46
+ },
47
+ "optionalPermissions": {
48
+ "items": {
49
+ "$ref": "#/$defs/ExtensionPermission"
50
+ },
51
+ "type": "array"
52
+ },
53
+ "permissions": {
54
+ "default": [],
55
+ "items": {
56
+ "$ref": "#/$defs/ExtensionPermission"
57
+ },
58
+ "type": "array"
59
+ },
60
+ "priority": {
61
+ "default": 0,
62
+ "format": "int32",
63
+ "type": "integer"
64
+ },
65
+ "scope": {
66
+ "$ref": "#/$defs/ExtensionScope"
67
+ },
68
+ "stateSchema": {
69
+ "format": "uint32",
70
+ "minimum": 0,
71
+ "type": [
72
+ "integer",
73
+ "null"
74
+ ]
75
+ },
76
+ "version": {
77
+ "type": "string"
78
+ }
79
+ },
80
+ "required": [
81
+ "id",
82
+ "version",
83
+ "entry",
84
+ "scope"
85
+ ],
86
+ "title": "ExtensionPackageManifest",
87
+ "type": "object"
88
+ }