@ifsoul/core 0.3.0 → 0.5.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.
Files changed (147) hide show
  1. package/README.md +30 -33
  2. package/dist/packages/memory/src/sql.js +54 -5
  3. package/dist/packages/protocol/src/generated/validators.cjs +1 -1
  4. package/dist/packages/protocol/src/index.d.ts +1 -6
  5. package/dist/packages/protocol/src/index.js +3 -16
  6. package/dist/packages/protocol/src/types.d.ts +1 -1
  7. package/dist/packages/runtime/src/behavior-types.d.ts +150 -0
  8. package/dist/packages/runtime/src/behavior-types.js +1 -0
  9. package/dist/packages/runtime/src/behavior.d.ts +40 -0
  10. package/dist/packages/runtime/src/behavior.js +621 -0
  11. package/dist/packages/runtime/src/group-scheduler.d.ts +165 -0
  12. package/dist/packages/runtime/src/group-scheduler.js +647 -0
  13. package/dist/packages/runtime/src/index.d.ts +4 -0
  14. package/dist/packages/runtime/src/index.js +4 -1
  15. package/dist/packages/runtime/src/participants.d.ts +107 -0
  16. package/dist/packages/runtime/src/participants.js +309 -0
  17. package/dist/packages/runtime/src/types.d.ts +1 -0
  18. package/package.json +2 -3
  19. package/packages/protocol/schemas/current/archive.schema.json +16 -16
  20. package/packages/protocol/schemas/current/character.schema.json +21 -21
  21. package/packages/protocol/schemas/current/common.schema.json +15 -15
  22. package/packages/protocol/schemas/current/context.schema.json +24 -24
  23. package/packages/protocol/schemas/current/conversation.schema.json +39 -39
  24. package/packages/protocol/schemas/current/environment.schema.json +18 -18
  25. package/packages/protocol/schemas/current/memory.schema.json +66 -66
  26. package/packages/protocol/schemas/current/model-provider.schema.json +40 -40
  27. package/packages/protocol/schemas/current/planning.schema.json +61 -61
  28. package/packages/protocol/schemas/current/provider-common.schema.json +6 -6
  29. package/release.json +7 -12
  30. package/specs/README.md +3 -86
  31. package/specs/current/README.md +3 -5
  32. package/specs/current/examples/archive-fork.json +12 -12
  33. package/specs/current/examples/archive-resume.json +12 -12
  34. package/specs/current/examples/character-instance.json +1 -1
  35. package/specs/current/examples/character-template.json +1 -1
  36. package/specs/current/examples/context-after-inspection.json +1 -1
  37. package/specs/current/examples/context-chat.json +1 -1
  38. package/specs/current/examples/context-daily.json +1 -1
  39. package/specs/current/examples/context-no-speech.json +1 -1
  40. package/specs/current/examples/conversation-delivery.json +1 -1
  41. package/specs/current/examples/conversation-live-request.json +1 -1
  42. package/specs/current/examples/conversation-live-response.json +1 -1
  43. package/specs/current/examples/conversation-no-speech-request.json +1 -1
  44. package/specs/current/examples/conversation-no-speech-response.json +1 -1
  45. package/specs/current/examples/conversation-requested-request.json +1 -1
  46. package/specs/current/examples/conversation-requested-response.json +1 -1
  47. package/specs/current/examples/environment-chat.json +1 -1
  48. package/specs/current/examples/environment-game.json +1 -1
  49. package/specs/current/examples/environment-no-speech.json +1 -1
  50. package/specs/current/examples/intent-checkpoint.json +1 -1
  51. package/specs/current/examples/memory-episode.json +1 -1
  52. package/specs/current/examples/memory-event-conversation.json +1 -1
  53. package/specs/current/examples/memory-event-observed.json +2 -2
  54. package/specs/current/examples/memory-event-plan-proposal.json +2 -2
  55. package/specs/current/examples/memory-event-proposed.json +2 -2
  56. package/specs/current/examples/memory-fact.json +1 -1
  57. package/specs/current/examples/memory-relationship.json +1 -1
  58. package/specs/current/examples/memory-working-context.json +1 -1
  59. package/specs/current/examples/plan-cancel-request.json +1 -1
  60. package/specs/current/examples/plan-cancel-result.json +1 -1
  61. package/specs/current/examples/plan-daily.json +1 -1
  62. package/specs/current/examples/plan-partial-decision.json +1 -1
  63. package/specs/current/examples/portable-memory.jsonl +9 -9
  64. package/specs/current/examples/task-outcome.json +1 -1
  65. package/specs/current/examples/task-progress.json +1 -1
  66. package/specs/current/model-provider/examples/capabilities.json +1 -1
  67. package/specs/current/model-provider/examples/error.json +1 -1
  68. package/specs/current/model-provider/examples/request.json +1 -1
  69. package/specs/current/model-provider/examples/response.json +1 -1
  70. package/docs/npm-publishing.md +0 -44
  71. package/packages/protocol/schemas/action-result.schema.json +0 -187
  72. package/packages/protocol/schemas/action.schema.json +0 -68
  73. package/packages/protocol/schemas/archive-manifest.schema.json +0 -126
  74. package/packages/protocol/schemas/capability.schema.json +0 -131
  75. package/packages/protocol/schemas/character-instance.schema.json +0 -73
  76. package/packages/protocol/schemas/character-template.schema.json +0 -67
  77. package/packages/protocol/schemas/common.schema.json +0 -154
  78. package/packages/protocol/schemas/derived-memory.schema.json +0 -145
  79. package/packages/protocol/schemas/memory-event.schema.json +0 -123
  80. package/packages/protocol/schemas/model-provider.schema.json +0 -326
  81. package/packages/protocol/schemas/perception.schema.json +0 -89
  82. package/packages/protocol/schemas/permission-policy.schema.json +0 -153
  83. package/packages/protocol/schemas/v0.2/archive.schema.json +0 -205
  84. package/packages/protocol/schemas/v0.2/character.schema.json +0 -344
  85. package/packages/protocol/schemas/v0.2/common.schema.json +0 -239
  86. package/packages/protocol/schemas/v0.2/context.schema.json +0 -230
  87. package/packages/protocol/schemas/v0.2/conversation.schema.json +0 -340
  88. package/packages/protocol/schemas/v0.2/environment.schema.json +0 -244
  89. package/packages/protocol/schemas/v0.2/memory.schema.json +0 -495
  90. package/packages/protocol/schemas/v0.2/planning.schema.json +0 -443
  91. package/packages/protocol/schemas/world-event.schema.json +0 -74
  92. package/specs/character/README.md +0 -84
  93. package/specs/character/examples/archive-manifest.json +0 -32
  94. package/specs/character/examples/character-instance.json +0 -20
  95. package/specs/character/examples/character-template.json +0 -19
  96. package/specs/memory/README.md +0 -80
  97. package/specs/memory/examples/derived-memory.json +0 -21
  98. package/specs/memory/examples/memory-event.json +0 -35
  99. package/specs/model-provider/README.md +0 -85
  100. package/specs/model-provider/examples/capabilities.json +0 -10
  101. package/specs/model-provider/examples/error.json +0 -18
  102. package/specs/model-provider/examples/request.json +0 -17
  103. package/specs/model-provider/examples/response.json +0 -19
  104. package/specs/v0.2/README.md +0 -421
  105. package/specs/v0.2/examples/archive-fork.json +0 -64
  106. package/specs/v0.2/examples/archive-resume.json +0 -63
  107. package/specs/v0.2/examples/character-instance.json +0 -57
  108. package/specs/v0.2/examples/character-template.json +0 -45
  109. package/specs/v0.2/examples/context-after-inspection.json +0 -44
  110. package/specs/v0.2/examples/context-chat.json +0 -27
  111. package/specs/v0.2/examples/context-daily.json +0 -69
  112. package/specs/v0.2/examples/context-no-speech.json +0 -27
  113. package/specs/v0.2/examples/conversation-delivery.json +0 -17
  114. package/specs/v0.2/examples/conversation-live-request.json +0 -31
  115. package/specs/v0.2/examples/conversation-live-response.json +0 -23
  116. package/specs/v0.2/examples/conversation-no-speech-request.json +0 -23
  117. package/specs/v0.2/examples/conversation-no-speech-response.json +0 -22
  118. package/specs/v0.2/examples/conversation-requested-request.json +0 -31
  119. package/specs/v0.2/examples/conversation-requested-response.json +0 -23
  120. package/specs/v0.2/examples/environment-chat.json +0 -43
  121. package/specs/v0.2/examples/environment-game.json +0 -80
  122. package/specs/v0.2/examples/environment-no-speech.json +0 -47
  123. package/specs/v0.2/examples/intent-checkpoint.json +0 -29
  124. package/specs/v0.2/examples/memory-episode.json +0 -28
  125. package/specs/v0.2/examples/memory-event-conversation.json +0 -32
  126. package/specs/v0.2/examples/memory-event-observed.json +0 -50
  127. package/specs/v0.2/examples/memory-event-plan-proposal.json +0 -82
  128. package/specs/v0.2/examples/memory-event-proposed.json +0 -53
  129. package/specs/v0.2/examples/memory-fact.json +0 -23
  130. package/specs/v0.2/examples/memory-relationship.json +0 -25
  131. package/specs/v0.2/examples/memory-working-context.json +0 -24
  132. package/specs/v0.2/examples/plan-cancel-request.json +0 -16
  133. package/specs/v0.2/examples/plan-cancel-result.json +0 -21
  134. package/specs/v0.2/examples/plan-daily.json +0 -57
  135. package/specs/v0.2/examples/plan-partial-decision.json +0 -28
  136. package/specs/v0.2/examples/portable-memory.jsonl +0 -9
  137. package/specs/v0.2/examples/task-outcome.json +0 -21
  138. package/specs/v0.2/examples/task-progress.json +0 -19
  139. package/specs/world-adapter/README.md +0 -114
  140. package/specs/world-adapter/examples/action-result-unknown.json +0 -23
  141. package/specs/world-adapter/examples/action-result.json +0 -45
  142. package/specs/world-adapter/examples/action.json +0 -17
  143. package/specs/world-adapter/examples/capability.json +0 -44
  144. package/specs/world-adapter/examples/perception.json +0 -30
  145. package/specs/world-adapter/examples/permission-decision.json +0 -14
  146. package/specs/world-adapter/examples/permission-policy.json +0 -17
  147. package/specs/world-adapter/examples/world-event.json +0 -25
@@ -1,239 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "urn:ifsoul:protocol:draft-0.2.0:common",
4
- "description": "Shared definitions only; not an exchange document.",
5
- "$defs": {
6
- "id": {
7
- "type": "string",
8
- "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
9
- },
10
- "utc": {
11
- "type": "string",
12
- "format": "date-time",
13
- "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?Z$"
14
- },
15
- "extensionName": {
16
- "type": "string",
17
- "pattern": "^[a-z][a-z0-9-]*(?:\\.[a-z][a-z0-9-]*)+$"
18
- },
19
- "extensions": {
20
- "type": "object",
21
- "maxProperties": 16,
22
- "propertyNames": {
23
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/extensionName"
24
- },
25
- "additionalProperties": true
26
- },
27
- "binding": {
28
- "type": "object",
29
- "properties": {
30
- "environmentId": {
31
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
32
- },
33
- "sessionId": {
34
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
35
- },
36
- "characterId": {
37
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
38
- },
39
- "embodimentId": {
40
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
41
- }
42
- },
43
- "required": ["environmentId", "sessionId", "characterId", "embodimentId"],
44
- "additionalProperties": false
45
- },
46
- "worldTime": {
47
- "type": "object",
48
- "properties": {
49
- "timelineId": {
50
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
51
- },
52
- "tick": {
53
- "type": "integer",
54
- "minimum": 0,
55
- "maximum": 9007199254740991
56
- }
57
- },
58
- "required": ["timelineId", "tick"],
59
- "additionalProperties": false
60
- },
61
- "period": {
62
- "oneOf": [
63
- {
64
- "type": "object",
65
- "properties": {
66
- "basis": {
67
- "const": "utc"
68
- },
69
- "startAt": {
70
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/utc"
71
- },
72
- "endAt": {
73
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/utc"
74
- }
75
- },
76
- "required": ["basis", "startAt", "endAt"],
77
- "additionalProperties": false
78
- },
79
- {
80
- "type": "object",
81
- "properties": {
82
- "basis": {
83
- "const": "world-ticks"
84
- },
85
- "timelineId": {
86
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
87
- },
88
- "fromTick": {
89
- "type": "integer",
90
- "minimum": 0,
91
- "maximum": 9007199254740991
92
- },
93
- "toTick": {
94
- "type": "integer",
95
- "minimum": 0,
96
- "maximum": 9007199254740991
97
- }
98
- },
99
- "required": ["basis", "timelineId", "fromTick", "toTick"],
100
- "additionalProperties": false
101
- }
102
- ]
103
- },
104
- "argument": {
105
- "oneOf": [
106
- {
107
- "type": "object",
108
- "properties": {
109
- "type": {
110
- "const": "entity-ref"
111
- },
112
- "entityId": {
113
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
114
- }
115
- },
116
- "required": ["type", "entityId"],
117
- "additionalProperties": false
118
- },
119
- {
120
- "type": "object",
121
- "properties": {
122
- "type": {
123
- "const": "choice"
124
- },
125
- "value": {
126
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
127
- }
128
- },
129
- "required": ["type", "value"],
130
- "additionalProperties": false
131
- },
132
- {
133
- "type": "object",
134
- "properties": {
135
- "type": {
136
- "const": "quantity"
137
- },
138
- "value": {
139
- "type": "number"
140
- },
141
- "unit": {
142
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
143
- }
144
- },
145
- "required": ["type", "value", "unit"],
146
- "additionalProperties": false
147
- },
148
- {
149
- "type": "object",
150
- "properties": {
151
- "type": {
152
- "const": "boolean"
153
- },
154
- "value": {
155
- "type": "boolean"
156
- }
157
- },
158
- "required": ["type", "value"],
159
- "additionalProperties": false
160
- }
161
- ]
162
- },
163
- "scope": {
164
- "type": "object",
165
- "properties": {
166
- "audience": {
167
- "enum": ["private", "participants", "public"]
168
- },
169
- "participantIds": {
170
- "type": "array",
171
- "items": {
172
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
173
- },
174
- "minItems": 0,
175
- "maxItems": 32,
176
- "uniqueItems": true
177
- },
178
- "export": {
179
- "enum": ["allowed", "consent-required", "forbidden"]
180
- }
181
- },
182
- "required": ["audience", "participantIds", "export"],
183
- "additionalProperties": false
184
- },
185
- "priority": {
186
- "enum": ["low", "normal", "high"]
187
- },
188
- "taskStatus": {
189
- "enum": [
190
- "pending",
191
- "running",
192
- "succeeded",
193
- "failed",
194
- "cancelled",
195
- "unknown"
196
- ]
197
- },
198
- "provenance": {
199
- "type": "object",
200
- "properties": {
201
- "sources": {
202
- "type": "array",
203
- "items": {
204
- "type": "object",
205
- "properties": {
206
- "sourceType": {
207
- "enum": [
208
- "authored",
209
- "host-report",
210
- "conversation",
211
- "memory",
212
- "derivation",
213
- "import",
214
- "plan-proposal",
215
- "plan-decision"
216
- ]
217
- },
218
- "sourceId": {
219
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
220
- }
221
- },
222
- "required": ["sourceType", "sourceId"],
223
- "additionalProperties": false
224
- },
225
- "minItems": 0,
226
- "maxItems": 64
227
- },
228
- "description": {
229
- "type": "string",
230
- "minLength": 1,
231
- "maxLength": 2000
232
- }
233
- },
234
- "required": ["sources"],
235
- "additionalProperties": false
236
- }
237
- },
238
- "not": {}
239
- }
@@ -1,230 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "urn:ifsoul:protocol:draft-0.2.0:context",
4
- "type": "object",
5
- "properties": {
6
- "schemaVersion": {
7
- "const": "draft-0.2.0"
8
- },
9
- "kind": {
10
- "const": "context-report"
11
- },
12
- "reportId": {
13
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
14
- },
15
- "contextRevision": {
16
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
17
- },
18
- "environmentRevision": {
19
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
20
- },
21
- "correlationId": {
22
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
23
- },
24
- "binding": {
25
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/binding"
26
- },
27
- "recordedAt": {
28
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/utc"
29
- },
30
- "period": {
31
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/period"
32
- },
33
- "observedState": {
34
- "type": "object",
35
- "properties": {
36
- "summary": {
37
- "type": "string",
38
- "minLength": 1,
39
- "maxLength": 4000
40
- },
41
- "properties": {
42
- "type": "array",
43
- "items": {
44
- "type": "object",
45
- "properties": {
46
- "subjectId": {
47
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
48
- },
49
- "propertyId": {
50
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
51
- },
52
- "value": {
53
- "anyOf": [
54
- {
55
- "type": "string",
56
- "maxLength": 500
57
- },
58
- {
59
- "type": "number"
60
- },
61
- {
62
- "type": "boolean"
63
- }
64
- ]
65
- }
66
- },
67
- "required": ["subjectId", "propertyId", "value"],
68
- "additionalProperties": false
69
- },
70
- "minItems": 0,
71
- "maxItems": 128
72
- }
73
- },
74
- "required": ["summary", "properties"],
75
- "additionalProperties": false
76
- },
77
- "priorNeeds": {
78
- "type": "array",
79
- "items": {
80
- "type": "object",
81
- "properties": {
82
- "needId": {
83
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
84
- },
85
- "description": {
86
- "type": "string",
87
- "minLength": 1,
88
- "maxLength": 500
89
- },
90
- "priority": {
91
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/priority"
92
- },
93
- "status": {
94
- "enum": ["current", "resolved", "unknown"]
95
- }
96
- },
97
- "required": ["needId", "description", "priority", "status"],
98
- "additionalProperties": false
99
- },
100
- "minItems": 0,
101
- "maxItems": 32
102
- },
103
- "priorPlans": {
104
- "type": "array",
105
- "items": {
106
- "type": "object",
107
- "properties": {
108
- "planId": {
109
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
110
- },
111
- "taskStates": {
112
- "type": "array",
113
- "items": {
114
- "type": "object",
115
- "properties": {
116
- "taskId": {
117
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
118
- },
119
- "status": {
120
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/taskStatus"
121
- }
122
- },
123
- "required": ["taskId", "status"],
124
- "additionalProperties": false
125
- },
126
- "minItems": 0,
127
- "maxItems": 16
128
- }
129
- },
130
- "required": ["planId", "taskStates"],
131
- "additionalProperties": false
132
- },
133
- "minItems": 0,
134
- "maxItems": 16
135
- },
136
- "changes": {
137
- "type": "array",
138
- "items": {
139
- "type": "object",
140
- "properties": {
141
- "changeId": {
142
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
143
- },
144
- "kind": {
145
- "enum": ["change", "event"]
146
- },
147
- "recordedAt": {
148
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/utc"
149
- },
150
- "summary": {
151
- "type": "string",
152
- "minLength": 1,
153
- "maxLength": 1000
154
- },
155
- "worldTime": {
156
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/worldTime"
157
- }
158
- },
159
- "required": ["changeId", "kind", "recordedAt", "summary"],
160
- "additionalProperties": false
161
- },
162
- "minItems": 0,
163
- "maxItems": 64
164
- },
165
- "planningRequest": {
166
- "type": "object",
167
- "properties": {
168
- "requestId": {
169
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
170
- },
171
- "cadence": {
172
- "enum": ["host-requested", "daily", "event-driven"]
173
- },
174
- "horizon": {
175
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/period"
176
- },
177
- "maxTasks": {
178
- "type": "integer",
179
- "minimum": 1,
180
- "maximum": 16
181
- },
182
- "allowedIntentIds": {
183
- "type": "array",
184
- "items": {
185
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/id"
186
- },
187
- "minItems": 0,
188
- "maxItems": 32,
189
- "uniqueItems": true
190
- }
191
- },
192
- "required": [
193
- "requestId",
194
- "cadence",
195
- "horizon",
196
- "maxTasks",
197
- "allowedIntentIds"
198
- ],
199
- "additionalProperties": false
200
- },
201
- "extensions": {
202
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/extensions"
203
- },
204
- "requiredExtensions": {
205
- "type": "array",
206
- "items": {
207
- "$ref": "urn:ifsoul:protocol:draft-0.2.0:common#/$defs/extensionName"
208
- },
209
- "minItems": 0,
210
- "maxItems": 16,
211
- "uniqueItems": true
212
- }
213
- },
214
- "required": [
215
- "schemaVersion",
216
- "kind",
217
- "reportId",
218
- "contextRevision",
219
- "environmentRevision",
220
- "correlationId",
221
- "binding",
222
- "recordedAt",
223
- "period",
224
- "observedState",
225
- "priorNeeds",
226
- "priorPlans",
227
- "changes"
228
- ],
229
- "additionalProperties": false
230
- }