awp-python 0.1.0a1__py3-none-any.whl

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 (71) hide show
  1. awp/__init__.py +64 -0
  2. awp/_spec/lifecycle.json +190 -0
  3. awp/_spec/schemas/action-cancel-result.schema.json +13 -0
  4. awp/_spec/schemas/action-ref.schema.json +11 -0
  5. awp/_spec/schemas/action-schema.schema.json +37 -0
  6. awp/_spec/schemas/action-status.schema.json +39 -0
  7. awp/_spec/schemas/action-submit-result.schema.json +16 -0
  8. awp/_spec/schemas/action-submit.schema.json +19 -0
  9. awp/_spec/schemas/agent-manifest.schema.json +27 -0
  10. awp/_spec/schemas/approval-requested.schema.json +25 -0
  11. awp/_spec/schemas/approval-respond.schema.json +31 -0
  12. awp/_spec/schemas/common.schema.json +150 -0
  13. awp/_spec/schemas/embodiment.schema.json +22 -0
  14. awp/_spec/schemas/empty-result.schema.json +8 -0
  15. awp/_spec/schemas/error.schema.json +25 -0
  16. awp/_spec/schemas/frame-inline.schema.json +20 -0
  17. awp/_spec/schemas/frame-tree.schema.json +26 -0
  18. awp/_spec/schemas/obs-report.schema.json +40 -0
  19. awp/_spec/schemas/observation-channel.schema.json +28 -0
  20. awp/_spec/schemas/ping-result.schema.json +13 -0
  21. awp/_spec/schemas/ping.schema.json +12 -0
  22. awp/_spec/schemas/profiles/gui-actions.schema.json +57 -0
  23. awp/_spec/schemas/reset-result.schema.json +11 -0
  24. awp/_spec/schemas/reset.schema.json +12 -0
  25. awp/_spec/schemas/restore.schema.json +11 -0
  26. awp/_spec/schemas/safety-policy.schema.json +81 -0
  27. awp/_spec/schemas/session-open.schema.json +41 -0
  28. awp/_spec/schemas/session-ready.schema.json +50 -0
  29. awp/_spec/schemas/session-resume.schema.json +12 -0
  30. awp/_spec/schemas/session-state.schema.json +14 -0
  31. awp/_spec/schemas/session-telemetry.schema.json +22 -0
  32. awp/_spec/schemas/session-transfer-result.schema.json +12 -0
  33. awp/_spec/schemas/session-transfer.schema.json +11 -0
  34. awp/_spec/schemas/snapshot-result.schema.json +11 -0
  35. awp/_spec/schemas/subscribe-result.schema.json +11 -0
  36. awp/_spec/schemas/subscribe.schema.json +11 -0
  37. awp/_spec/schemas/task-update.schema.json +11 -0
  38. awp/_spec/schemas/tick-result.schema.json +9 -0
  39. awp/_spec/schemas/tick.schema.json +12 -0
  40. awp/_spec/schemas/unsubscribe.schema.json +11 -0
  41. awp/_spec/schemas/world-event.schema.json +45 -0
  42. awp/_spec/schemas/world-manifest.schema.json +61 -0
  43. awp/aio.py +380 -0
  44. awp/client.py +781 -0
  45. awp/clock.py +61 -0
  46. awp/errors.py +112 -0
  47. awp/frames.py +174 -0
  48. awp/jsonrpc.py +84 -0
  49. awp/lifecycle.py +78 -0
  50. awp/py.typed +0 -0
  51. awp/schema.py +158 -0
  52. awp_python-0.1.0a1.dist-info/METADATA +127 -0
  53. awp_python-0.1.0a1.dist-info/RECORD +71 -0
  54. awp_python-0.1.0a1.dist-info/WHEEL +4 -0
  55. awp_python-0.1.0a1.dist-info/entry_points.txt +2 -0
  56. awp_python-0.1.0a1.dist-info/licenses/LICENSE +201 -0
  57. awp_sim/__init__.py +8 -0
  58. awp_sim/__main__.py +5 -0
  59. awp_sim/arm.py +163 -0
  60. awp_sim/audit.py +138 -0
  61. awp_sim/cli.py +238 -0
  62. awp_sim/config.py +225 -0
  63. awp_sim/demo.py +85 -0
  64. awp_sim/loopback.py +222 -0
  65. awp_sim/py.typed +0 -0
  66. awp_sim/recorder.py +72 -0
  67. awp_sim/replay.py +134 -0
  68. awp_sim/scenarios.py +427 -0
  69. awp_sim/server.py +333 -0
  70. awp_sim/session.py +153 -0
  71. awp_sim/world.py +1612 -0
awp/__init__.py ADDED
@@ -0,0 +1,64 @@
1
+ """Agent World Protocol client protocol layer.
2
+
3
+ `ClientConnection` is the agent side of AWP as a sans-IO state machine; `awp.aio.AsyncClient`
4
+ drives it over a WebSocket. This package targets the specification revision in `SPEC_REVISION`.
5
+ """
6
+
7
+ from importlib.metadata import PackageNotFoundError, version
8
+
9
+ from .client import (
10
+ ActionRecord,
11
+ ActionUpdated,
12
+ ApprovalRequested,
13
+ ClientConnection,
14
+ ErrorResponse,
15
+ Event,
16
+ FrameReceived,
17
+ Initialized,
18
+ ProtocolViolation,
19
+ ReplayCompleted,
20
+ Response,
21
+ SessionOpened,
22
+ SessionStateChanged,
23
+ Telemetry,
24
+ TickCompleted,
25
+ WorldEvent,
26
+ )
27
+ from .errors import AwpError, ErrorCode, ProtocolError
28
+ from .frames import Frame
29
+ from .lifecycle import ActionState
30
+
31
+ SPEC_REVISION = "0.1-draft.7"
32
+ PROTOCOL_VERSION = "0.1"
33
+
34
+ try:
35
+ __version__ = version("awp-python")
36
+ except PackageNotFoundError: # pragma: no cover - running from a source tree without install
37
+ __version__ = "0.0.0"
38
+
39
+ __all__ = [
40
+ "PROTOCOL_VERSION",
41
+ "SPEC_REVISION",
42
+ "ActionRecord",
43
+ "ActionState",
44
+ "ActionUpdated",
45
+ "ApprovalRequested",
46
+ "AwpError",
47
+ "ClientConnection",
48
+ "ErrorCode",
49
+ "ErrorResponse",
50
+ "Event",
51
+ "Frame",
52
+ "FrameReceived",
53
+ "Initialized",
54
+ "ProtocolError",
55
+ "ProtocolViolation",
56
+ "ReplayCompleted",
57
+ "Response",
58
+ "SessionOpened",
59
+ "SessionStateChanged",
60
+ "Telemetry",
61
+ "TickCompleted",
62
+ "WorldEvent",
63
+ "__version__",
64
+ ]
@@ -0,0 +1,190 @@
1
+ {
2
+ "states": {
3
+ "submitted": "transient",
4
+ "pending_approval": "pre-execution",
5
+ "queued": "pre-execution",
6
+ "accepted": "pre-execution",
7
+ "executing": "execution",
8
+ "cancelling": "execution",
9
+ "rejected": "terminal",
10
+ "completed": "terminal",
11
+ "failed": "terminal",
12
+ "preempted": "terminal",
13
+ "cancelled": "terminal"
14
+ },
15
+ "transitions": [
16
+ {
17
+ "from": "submitted",
18
+ "to": "rejected",
19
+ "label": "validation, grant, envelope, or intent check fails",
20
+ "wire": "error"
21
+ },
22
+ {
23
+ "from": "submitted",
24
+ "to": "pending_approval",
25
+ "label": "type requires approval"
26
+ },
27
+ {
28
+ "from": "submitted",
29
+ "to": "queued",
30
+ "label": "group busy and preempt is queue"
31
+ },
32
+ {
33
+ "from": "submitted",
34
+ "to": "accepted",
35
+ "label": "admitted"
36
+ },
37
+ {
38
+ "from": "pending_approval",
39
+ "to": "queued",
40
+ "label": "approved and group busy"
41
+ },
42
+ {
43
+ "from": "pending_approval",
44
+ "to": "accepted",
45
+ "label": "approved"
46
+ },
47
+ {
48
+ "from": "pending_approval",
49
+ "to": "rejected",
50
+ "label": "denied, timeout, deadline, re-check fails",
51
+ "reasons": [
52
+ "approval_denied",
53
+ "approval_timeout",
54
+ "deadline_exceeded",
55
+ "stale_intent",
56
+ "forbidden",
57
+ "envelope"
58
+ ]
59
+ },
60
+ {
61
+ "from": "pending_approval",
62
+ "to": "cancelled",
63
+ "label": "cancel, e-stop, safe state, close, reset, transfer, superseded",
64
+ "reasons": [
65
+ "cancelled_by_agent",
66
+ "e_stop",
67
+ "safe_state",
68
+ "session_closed",
69
+ "world_reset",
70
+ "transferred",
71
+ "superseded"
72
+ ]
73
+ },
74
+ {
75
+ "from": "queued",
76
+ "to": "accepted",
77
+ "label": "group free"
78
+ },
79
+ {
80
+ "from": "queued",
81
+ "to": "rejected",
82
+ "label": "deadline or re-check fails",
83
+ "reasons": [
84
+ "deadline_exceeded",
85
+ "stale_intent",
86
+ "forbidden",
87
+ "envelope"
88
+ ]
89
+ },
90
+ {
91
+ "from": "queued",
92
+ "to": "cancelled",
93
+ "label": "cancel, e-stop, safe state, close, reset, transfer, superseded",
94
+ "reasons": [
95
+ "cancelled_by_agent",
96
+ "e_stop",
97
+ "safe_state",
98
+ "session_closed",
99
+ "world_reset",
100
+ "transferred",
101
+ "superseded"
102
+ ]
103
+ },
104
+ {
105
+ "from": "accepted",
106
+ "to": "executing",
107
+ "label": "execution begins"
108
+ },
109
+ {
110
+ "from": "accepted",
111
+ "to": "rejected",
112
+ "label": "deadline or validity passes before execution",
113
+ "reasons": [
114
+ "deadline_exceeded",
115
+ "stale_intent"
116
+ ]
117
+ },
118
+ {
119
+ "from": "accepted",
120
+ "to": "cancelled",
121
+ "label": "cancel, e-stop, safe state, close, reset, transfer, superseded",
122
+ "reasons": [
123
+ "cancelled_by_agent",
124
+ "e_stop",
125
+ "safe_state",
126
+ "session_closed",
127
+ "world_reset",
128
+ "transferred",
129
+ "superseded"
130
+ ]
131
+ },
132
+ {
133
+ "from": "executing",
134
+ "to": "completed",
135
+ "label": "goal reached"
136
+ },
137
+ {
138
+ "from": "executing",
139
+ "to": "failed",
140
+ "label": "deadline, e-stop, safe state, envelope, watchdog, error",
141
+ "reasons": [
142
+ "deadline_exceeded",
143
+ "e_stop",
144
+ "connection_lost",
145
+ "envelope",
146
+ "watchdog",
147
+ "world_error"
148
+ ]
149
+ },
150
+ {
151
+ "from": "executing",
152
+ "to": "preempted",
153
+ "label": "newer replace or blend, transfer",
154
+ "reasons": [
155
+ "transferred"
156
+ ]
157
+ },
158
+ {
159
+ "from": "executing",
160
+ "to": "cancelling",
161
+ "label": "cancel, close, reset",
162
+ "reasons": [
163
+ "cancelled_by_agent",
164
+ "session_closed",
165
+ "world_reset"
166
+ ]
167
+ },
168
+ {
169
+ "from": "cancelling",
170
+ "to": "cancelled",
171
+ "label": "safe abort complete",
172
+ "reasons": [
173
+ "cancelled_by_agent",
174
+ "session_closed",
175
+ "world_reset"
176
+ ]
177
+ },
178
+ {
179
+ "from": "cancelling",
180
+ "to": "failed",
181
+ "label": "e-stop, safe state, abort fails",
182
+ "reasons": [
183
+ "e_stop",
184
+ "connection_lost",
185
+ "abort_failed",
186
+ "world_error"
187
+ ]
188
+ }
189
+ ]
190
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agentworldprotocol.com/schemas/v0.1/action-cancel-result.schema.json",
4
+ "title": "action.cancel result (AWP-LIF-005)",
5
+ "type": "object",
6
+ "properties": {
7
+ "action_id": { "$ref": "common.schema.json#/$defs/action_id" },
8
+ "state": { "$ref": "common.schema.json#/$defs/action_state" },
9
+ "status_seq": { "$ref": "common.schema.json#/$defs/status_seq" }
10
+ },
11
+ "required": ["action_id", "state", "status_seq"],
12
+ "additionalProperties": true
13
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agentworldprotocol.com/schemas/v0.1/action-ref.schema.json",
4
+ "title": "action.cancel and action.status (pull) params",
5
+ "type": "object",
6
+ "properties": {
7
+ "action_id": {"$ref": "common.schema.json#/$defs/action_id"}
8
+ },
9
+ "required": ["action_id"],
10
+ "x-awp-closed": true
11
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agentworldprotocol.com/schemas/v0.1/action-schema.schema.json",
4
+ "title": "Action type declaration",
5
+ "description": "An entry in world-manifest.action_schemas (spec/loop/actions, spec/loop/preemption, spec/loop/command-channels).",
6
+ "type": "object",
7
+ "properties": {
8
+ "type": { "$ref": "common.schema.json#/$defs/identifier", "description": "Action type name, unique per world." },
9
+ "params_schema": { "$ref": "common.schema.json#/$defs/json_schema", "description": "JSON Schema 2020-12 for params (AWP-MAN-002). Local $refs resolve against the manifest's $defs." },
10
+ "duration": { "type": "string", "enum": ["instant", "extended", "streaming"] },
11
+ "preemption": {
12
+ "description": "Declared policies the submitter may choose from (AWP-PRE-001).",
13
+ "oneOf": [
14
+ { "$ref": "common.schema.json#/$defs/preemption_policy" },
15
+ { "type": "array", "items": { "$ref": "common.schema.json#/$defs/preemption_policy" }, "minItems": 1, "uniqueItems": true }
16
+ ]
17
+ },
18
+ "concurrency_group": { "$ref": "common.schema.json#/$defs/identifier", "description": "Types sharing a group preempt one another (AWP-PRE-006)." },
19
+ "max_queue": { "type": "integer", "minimum": 1, "description": "Queue depth when queue is offered (AWP-PRE-002)." },
20
+ "requires_approval": { "type": "boolean", "default": false },
21
+ "command_channel": { "$ref": "common.schema.json#/$defs/identifier", "description": "Command channel this streaming type opens (AWP-CMD-002)." },
22
+ "watchdog_ms": { "type": "integer", "minimum": 1, "description": "Per-stream watchdog for streaming types (AWP-CMD-005)." },
23
+ "max_abort_ms": { "type": "integer", "minimum": 1, "description": "Upper bound on the cancelling state for this type (AWP-LIF-010)." },
24
+ "max_duration_ms": { "type": "integer", "minimum": 1, "description": "Extended types: longest execution the world permits; applies as a deadline when the submission's deadline_ms is absent or longer (AWP-ACT-008). Required for extended types in the robotics profile (AWP-ROB-007)." },
25
+ "description": { "type": "string" }
26
+ },
27
+ "required": ["type", "params_schema", "duration", "preemption"],
28
+ "allOf": [
29
+ {
30
+ "if": { "properties": { "duration": { "const": "streaming" } } },
31
+ "then": { "required": ["command_channel", "watchdog_ms"] },
32
+ "else": { "not": { "anyOf": [{ "required": ["command_channel"] }, { "required": ["watchdog_ms"] }] } }
33
+ }
34
+ ],
35
+ "patternProperties": { "^x-[a-z0-9]+\\.": {} },
36
+ "additionalProperties": true
37
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agentworldprotocol.com/schemas/v0.1/action-status.schema.json",
4
+ "title": "action.status params (notification and pull result)",
5
+ "type": "object",
6
+ "properties": {
7
+ "action_id": { "$ref": "common.schema.json#/$defs/action_id" },
8
+ "state": { "$ref": "common.schema.json#/$defs/action_state" },
9
+ "status_seq": { "$ref": "common.schema.json#/$defs/status_seq" },
10
+ "ts_mono_ns": { "$ref": "common.schema.json#/$defs/ts_mono_ns" },
11
+ "tick": { "$ref": "common.schema.json#/$defs/tick", "description": "Lockstep: tick of the transition." },
12
+ "progress": { "type": "number", "minimum": 0, "maximum": 1 },
13
+ "reason": { "$ref": "common.schema.json#/$defs/status_reason" },
14
+ "detail": { "type": "string" },
15
+ "clamped": { "type": "boolean" },
16
+ "blended": { "type": "boolean" },
17
+ "aborted_at_progress": { "type": "number", "minimum": 0, "maximum": 1 },
18
+ "stream": {
19
+ "type": "object",
20
+ "description": "Streaming-duration actions (AWP-CMD-004).",
21
+ "properties": {
22
+ "frames_applied": { "$ref": "common.schema.json#/$defs/u53" },
23
+ "last_seq": { "$ref": "common.schema.json#/$defs/seq" },
24
+ "clamped_count": { "$ref": "common.schema.json#/$defs/u53" }
25
+ },
26
+ "required": ["frames_applied", "last_seq"],
27
+ "additionalProperties": true
28
+ }
29
+ },
30
+ "required": ["action_id", "state", "status_seq", "ts_mono_ns"],
31
+ "allOf": [
32
+ {
33
+ "if": { "properties": { "state": { "enum": ["rejected", "failed", "cancelled"] } } },
34
+ "then": { "required": ["reason"] }
35
+ }
36
+ ],
37
+ "patternProperties": { "^x-[a-z0-9]+\\.": {} },
38
+ "additionalProperties": true
39
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agentworldprotocol.com/schemas/v0.1/action-submit-result.schema.json",
4
+ "title": "action.submit result (admission acknowledgement, AWP-LIF-002)",
5
+ "type": "object",
6
+ "properties": {
7
+ "action_id": { "$ref": "common.schema.json#/$defs/action_id" },
8
+ "state": { "$ref": "common.schema.json#/$defs/action_state", "description": "A first submission reports pending_approval, queued, or accepted. An idempotent resubmission reports the action's current state (AWP-ACT-001)." },
9
+ "status_seq": { "$ref": "common.schema.json#/$defs/status_seq", "description": "The transition this result reports; for an idempotent resubmission, the action's most recent transition (no new status_seq is consumed)." },
10
+ "received_ts_mono_ns": { "$ref": "common.schema.json#/$defs/ts_mono_ns", "description": "Session-clock time the world received the submission; origin of deadline_ms and of admission latency." },
11
+ "ts_mono_ns": { "$ref": "common.schema.json#/$defs/ts_mono_ns", "description": "Time of the reported transition." },
12
+ "reason": { "$ref": "common.schema.json#/$defs/status_reason", "description": "Present when an idempotent resubmission reports a rejected, failed, or cancelled action." }
13
+ },
14
+ "required": ["action_id", "state", "status_seq", "received_ts_mono_ns", "ts_mono_ns"],
15
+ "additionalProperties": true
16
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agentworldprotocol.com/schemas/v0.1/action-submit.schema.json",
4
+ "title": "action.submit params",
5
+ "type": "object",
6
+ "properties": {
7
+ "action_id": { "$ref": "common.schema.json#/$defs/action_id" },
8
+ "type": { "$ref": "common.schema.json#/$defs/identifier" },
9
+ "params": { "type": "object" },
10
+ "embodiment_id": { "$ref": "common.schema.json#/$defs/identifier", "description": "Required in multi-bind sessions (AWP-EMB-005)." },
11
+ "preempt": { "$ref": "common.schema.json#/$defs/preemption_policy" },
12
+ "deadline_ms": { "type": "integer", "minimum": 1, "description": "From world receipt; covers approval and queue wait (AWP-ACT-004)." },
13
+ "basis_ts_mono_ns": { "$ref": "common.schema.json#/$defs/ts_mono_ns", "description": "Capture time of the newest observation this intent relies on (AWP-ACT-007)." },
14
+ "valid_until_ns": { "$ref": "common.schema.json#/$defs/ts_mono_ns", "description": "Session-clock instant after which the intent must not begin executing (AWP-ACT-007)." }
15
+ },
16
+ "required": ["action_id", "type", "params"],
17
+ "patternProperties": { "^x-[a-z0-9]+\\.": {} },
18
+ "additionalProperties": true
19
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agentworldprotocol.com/schemas/v0.1/agent-manifest.schema.json",
4
+ "title": "Agent manifest (initialize params)",
5
+ "description": "What the agent declares in initialize (spec/session/agent-manifest).",
6
+ "type": "object",
7
+ "properties": {
8
+ "protocol_versions": { "type": "array", "items": { "$ref": "common.schema.json#/$defs/protocol_version" }, "minItems": 1, "uniqueItems": true },
9
+ "agent": {
10
+ "type": "object",
11
+ "properties": {
12
+ "name": { "type": "string", "minLength": 1 },
13
+ "version": { "type": "string", "minLength": 1 },
14
+ "vendor": { "type": "string", "minLength": 1 }
15
+ },
16
+ "required": ["name", "version", "vendor"],
17
+ "additionalProperties": true
18
+ },
19
+ "consumes_modalities": { "type": "array", "items": { "type": "string", "minLength": 1 }, "minItems": 1, "uniqueItems": true },
20
+ "time_models": { "type": "array", "items": { "$ref": "common.schema.json#/$defs/time_model" }, "minItems": 1, "uniqueItems": true, "default": ["lockstep", "streaming"] },
21
+ "max_obs_rate_hz": { "type": "number", "exclusiveMinimum": 0 },
22
+ "extensions": { "$ref": "common.schema.json#/$defs/extensions" }
23
+ },
24
+ "required": ["protocol_versions", "agent", "consumes_modalities"],
25
+ "patternProperties": { "^x-[a-z0-9]+\\.": {} },
26
+ "additionalProperties": true
27
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agentworldprotocol.com/schemas/v0.1/approval-requested.schema.json",
4
+ "title": "safety.approval_requested params (AWP-APR-001)",
5
+ "type": "object",
6
+ "properties": {
7
+ "approval_id": { "type": "string", "minLength": 1 },
8
+ "action_id": { "$ref": "common.schema.json#/$defs/action_id" },
9
+ "type": { "$ref": "common.schema.json#/$defs/identifier" },
10
+ "params": { "type": "object" },
11
+ "requester": {
12
+ "type": "object",
13
+ "properties": {
14
+ "session": { "type": "string" },
15
+ "embodiment": { "$ref": "common.schema.json#/$defs/identifier" }
16
+ },
17
+ "required": ["session"],
18
+ "additionalProperties": true
19
+ },
20
+ "task": { "$ref": "common.schema.json#/$defs/task" },
21
+ "expires_at_ns": { "$ref": "common.schema.json#/$defs/ts_mono_ns" }
22
+ },
23
+ "required": ["approval_id", "action_id", "type", "params", "requester", "expires_at_ns"],
24
+ "additionalProperties": true
25
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agentworldprotocol.com/schemas/v0.1/approval-respond.schema.json",
4
+ "title": "safety.approval.respond params (AWP-APR-002)",
5
+ "type": "object",
6
+ "properties": {
7
+ "approval_id": { "type": "string", "minLength": 1 },
8
+ "decision": { "type": "string", "enum": ["approve", "deny"] },
9
+ "note": { "type": "string" },
10
+ "standing": {
11
+ "type": "object",
12
+ "description": "Scoped standing approval (AWP-APR-004).",
13
+ "properties": {
14
+ "scope": {
15
+ "type": "object",
16
+ "properties": {
17
+ "type": { "$ref": "common.schema.json#/$defs/identifier" },
18
+ "predicate": { "type": "object", "description": "JSON Schema the params must satisfy." }
19
+ },
20
+ "required": ["type"],
21
+ "x-awp-closed": true
22
+ },
23
+ "expires_at": { "$ref": "common.schema.json#/$defs/ts_mono_ns" }
24
+ },
25
+ "required": ["scope", "expires_at"],
26
+ "x-awp-closed": true
27
+ }
28
+ },
29
+ "required": ["approval_id", "decision"],
30
+ "x-awp-closed": true
31
+ }
@@ -0,0 +1,150 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://agentworldprotocol.com/schemas/v0.1/common.schema.json",
4
+ "title": "AWP common definitions",
5
+ "description": "Shared primitives referenced by every other AWP schema. Apache-2.0.",
6
+ "$defs": {
7
+ "u53": {
8
+ "description": "Unsigned 64-bit value carried as a JSON integer; bounded by 2^53-1 (AWP-CTL-009).",
9
+ "type": "integer",
10
+ "minimum": 0,
11
+ "maximum": 9007199254740991
12
+ },
13
+ "i53": {
14
+ "description": "Signed 64-bit value carried as a JSON integer; bounded by ±(2^53-1) (AWP-CTL-009).",
15
+ "type": "integer",
16
+ "minimum": -9007199254740991,
17
+ "maximum": 9007199254740991
18
+ },
19
+ "ts_mono_ns": { "$ref": "#/$defs/u53", "description": "Nanoseconds on the session monotonic clock (AWP-CLK-001)." },
20
+ "ts_sim_ns": { "$ref": "#/$defs/i53", "description": "Simulated time in nanoseconds (AWP-CLK-003)." },
21
+ "ts_send_ns": { "$ref": "#/$defs/u53", "description": "Session-clock time at which a frame was handed to the transport (AWP-OBS-006)." },
22
+ "agent_ns": { "$ref": "#/$defs/u53", "description": "Nanoseconds on the agent's monotonic clock (AWP-CLK-006)." },
23
+ "tick": { "$ref": "#/$defs/u53", "description": "Lockstep tick number." },
24
+ "seq": { "$ref": "#/$defs/u53", "description": "Per-channel frame sequence number (AWP-DAT-001)." },
25
+ "status_seq": { "$ref": "#/$defs/u53", "description": "Per-session notification sequence shared by action.status, world.event, and session.state (AWP-CTL-008)." },
26
+ "session_id": { "type": "string", "minLength": 1, "maxLength": 128, "description": "World-assigned session identifier; not a credential (AWP-SES-009)." },
27
+ "session_state": { "type": "string", "enum": ["negotiating", "ready", "active", "suspended", "closed"] },
28
+ "channel_id": { "type": "integer", "minimum": 0, "maximum": 65535 },
29
+ "channel_grant": {
30
+ "description": "A granted channel subscription as enumerated in session.ready and obs.subscribe results (AWP-NEG-001).",
31
+ "type": "object",
32
+ "properties": {
33
+ "channel": { "$ref": "#/$defs/identifier" },
34
+ "rate_hz": { "oneOf": [{ "type": "number", "exclusiveMinimum": 0 }, { "type": "null" }] },
35
+ "channel_id": { "$ref": "#/$defs/channel_id" }
36
+ },
37
+ "required": ["channel", "rate_hz", "channel_id"],
38
+ "x-awp-closed": true
39
+ },
40
+ "latency_stats": {
41
+ "description": "Distribution of a latency or staleness quantity over a measurement window, in nanoseconds. Present only when count > 0.",
42
+ "type": "object",
43
+ "properties": {
44
+ "count": { "$ref": "#/$defs/u53", "description": "Samples in the window." },
45
+ "p50": { "$ref": "#/$defs/u53" },
46
+ "p95": { "$ref": "#/$defs/u53" },
47
+ "max": { "$ref": "#/$defs/u53" }
48
+ },
49
+ "required": ["count", "p50", "p95"],
50
+ "x-awp-closed": true
51
+ },
52
+ "per_channel": {
53
+ "description": "Object keyed by the decimal channel_id assigned in session.ready.",
54
+ "type": "object",
55
+ "propertyNames": { "pattern": "^(0|[1-9][0-9]{0,4})$" }
56
+ },
57
+ "identifier": {
58
+ "description": "Names for channels, action types, embodiments, frames, entities.",
59
+ "type": "string",
60
+ "minLength": 1,
61
+ "maxLength": 128,
62
+ "pattern": "^[A-Za-z_][A-Za-z0-9_.:-]*$"
63
+ },
64
+ "action_id": { "type": "string", "minLength": 1, "maxLength": 128 },
65
+ "protocol_version": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+$" },
66
+ "vendor_key": {
67
+ "description": "Extension key naming per AWP-VER-004.",
68
+ "type": "string",
69
+ "pattern": "^x-[a-z0-9]+\\.[A-Za-z0-9_.-]+$"
70
+ },
71
+ "extensions": {
72
+ "description": "Vendor extension map; keys use the x-<vendor>. prefix (AWP-VER-004).",
73
+ "type": "object",
74
+ "propertyNames": { "$ref": "#/$defs/vendor_key" }
75
+ },
76
+ "quaternion": {
77
+ "description": "Unit quaternion [x, y, z, w] (AWP-UNI-002).",
78
+ "type": "array",
79
+ "items": { "type": "number" },
80
+ "minItems": 4,
81
+ "maxItems": 4
82
+ },
83
+ "vec3_m": {
84
+ "type": "array",
85
+ "items": { "type": "number" },
86
+ "minItems": 3,
87
+ "maxItems": 3
88
+ },
89
+ "transform": {
90
+ "type": "object",
91
+ "properties": { "p_m": { "$ref": "#/$defs/vec3_m" }, "q": { "$ref": "#/$defs/quaternion" } },
92
+ "required": ["p_m", "q"],
93
+ "x-awp-closed": true
94
+ },
95
+ "pose": {
96
+ "description": "A pose in a named frame (AWP-UNI-003).",
97
+ "type": "object",
98
+ "properties": {
99
+ "frame": { "$ref": "#/$defs/identifier" },
100
+ "p_m": { "$ref": "#/$defs/vec3_m" },
101
+ "q": { "$ref": "#/$defs/quaternion" }
102
+ },
103
+ "required": ["frame", "p_m", "q"],
104
+ "x-awp-closed": true
105
+ },
106
+ "time_model": { "type": "string", "enum": ["lockstep", "streaming"] },
107
+ "loss_class": { "type": "string", "enum": ["reliable", "latest-wins"] },
108
+ "action_state": {
109
+ "type": "string",
110
+ "enum": ["pending_approval", "queued", "accepted", "executing", "cancelling", "rejected", "completed", "failed", "preempted", "cancelled"]
111
+ },
112
+ "terminal_state": { "type": "string", "enum": ["rejected", "completed", "failed", "preempted", "cancelled"] },
113
+ "status_reason": {
114
+ "description": "Status reason registry (spec/loop/events-and-errors#status-reasons) or a vendor reason.",
115
+ "anyOf": [
116
+ {
117
+ "type": "string",
118
+ "enum": [
119
+ "params_invalid", "forbidden", "envelope", "approval_denied", "approval_timeout", "deadline_exceeded", "stale_intent",
120
+ "cancelled_by_agent", "superseded", "e_stop", "connection_lost", "safe_state", "session_closed",
121
+ "world_reset", "transferred", "abort_failed", "watchdog", "world_error"
122
+ ]
123
+ },
124
+ { "$ref": "#/$defs/vendor_key" }
125
+ ]
126
+ },
127
+ "preemption_policy": { "type": "string", "enum": ["queue", "replace", "blend", "reject"] },
128
+ "admin_operation": { "type": "string", "enum": ["snapshot", "restore", "reset", "tick"] },
129
+ "content_block": {
130
+ "description": "Task content block (AWP-TSK-002). text is Markdown; other types are world-defined.",
131
+ "type": "object",
132
+ "properties": { "type": { "type": "string", "minLength": 1 } },
133
+ "required": ["type"],
134
+ "if": { "properties": { "type": { "const": "text" } } },
135
+ "then": { "properties": { "text": { "type": "string" } }, "required": ["text"] }
136
+ },
137
+ "task": {
138
+ "type": "object",
139
+ "properties": {
140
+ "content": { "type": "array", "items": { "$ref": "#/$defs/content_block" }, "minItems": 1 }
141
+ },
142
+ "required": ["content"],
143
+ "x-awp-closed": true
144
+ },
145
+ "json_schema": {
146
+ "description": "An embedded JSON Schema 2020-12 document (AWP-MAN-002).",
147
+ "$ref": "https://json-schema.org/draft/2020-12/schema"
148
+ }
149
+ }
150
+ }