gestalt-mobile 0.17.2 → 0.18.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 (44) hide show
  1. package/README.md +5 -1
  2. package/dist/client/assets/index-B0Uq4OB0.css +1 -0
  3. package/dist/client/assets/index-orfZBEaD.js +27 -0
  4. package/dist/client/index.html +2 -2
  5. package/dist/server/server/app.js +6 -0
  6. package/dist/server/server/composition.js +413 -21
  7. package/dist/server/server/features/agent-activity/model.js +197 -0
  8. package/dist/server/server/features/agent-activity/registry.js +155 -0
  9. package/dist/server/server/features/autopilot/application/policy.js +55 -0
  10. package/dist/server/server/features/autopilot/application/ports.js +6 -0
  11. package/dist/server/server/features/autopilot/application/service.js +542 -0
  12. package/dist/server/server/features/autopilot/domain/autopilot-session.js +40 -0
  13. package/dist/server/server/features/autopilot/register-routes.js +9 -0
  14. package/dist/server/server/features/autopilot/toggle/endpoint.js +32 -0
  15. package/dist/server/server/features/org-plan-attention/application/ports.js +6 -0
  16. package/dist/server/server/features/org-plan-attention/get-active/endpoint.js +22 -0
  17. package/dist/server/server/features/org-plan-attention/register-routes.js +11 -0
  18. package/dist/server/server/features/org-plan-attention/resolve/endpoint.js +42 -0
  19. package/dist/server/server/features/plans/application/parse-supervised-plan.js +4 -0
  20. package/dist/server/server/features/sessions/get-history/endpoint.js +62 -2
  21. package/dist/server/server/features/sessions/get-history/history-mapper.js +17 -5
  22. package/dist/server/server/features/sessions/get-session/endpoint.js +3 -1
  23. package/dist/server/server/features/sessions/interaction/kind.js +1 -0
  24. package/dist/server/server/features/sessions/interaction/response-validator.js +5 -1
  25. package/dist/server/server/features/sessions/list-sessions/endpoint.js +2 -0
  26. package/dist/server/server/features/sessions/model/relay-session.js +3 -0
  27. package/dist/server/server/features/sessions/refresh-activity/endpoint.js +14 -0
  28. package/dist/server/server/features/sessions/register-routes.js +15 -2
  29. package/dist/server/server/features/sessions/respond-interaction/endpoint.js +15 -2
  30. package/dist/server/server/features/sessions/restore-session/endpoint.js +21 -5
  31. package/dist/server/server/features/skills/list-available/endpoint.js +3 -4
  32. package/dist/server/server/features/skills/model/skill-profile.js +13 -5
  33. package/dist/server/server/platform/codex/activity-facts.js +88 -0
  34. package/dist/server/server/platform/codex/server-request.js +21 -4
  35. package/dist/server/server/platform/codex/session-runtime.js +114 -22
  36. package/dist/server/server/platform/persistence/migrate.js +16 -1
  37. package/dist/server/server/platform/persistence/sqlite-autopilot-store.js +151 -0
  38. package/dist/server/server/platform/persistence/sqlite-event-journal.js +92 -4
  39. package/dist/server/server/platform/persistence/sqlite-pending-interaction-store.js +62 -3
  40. package/dist/server/server/platform/persistence/sqlite-session-repository.js +5 -2
  41. package/dist/server/shared/contracts/org-plan-attention.js +101 -0
  42. package/package.json +1 -1
  43. package/dist/client/assets/index-DgD-0I3M.js +0 -25
  44. package/dist/client/assets/index-e2lJ5XqL.css +0 -1
@@ -11,8 +11,8 @@ export class SqliteSessionRepository {
11
11
  }
12
12
  save(session) {
13
13
  this.db
14
- .prepare('INSERT INTO relay_sessions (id,workspace_id,workspace_path,profile,model,branch,thread_id,state,desired_state,active_turn_id,protocol_version,failure_count,effective_skill_selection_json,last_org_plan_json,created_at,updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ON CONFLICT(id) DO UPDATE SET workspace_id=excluded.workspace_id,workspace_path=excluded.workspace_path,profile=excluded.profile,model=excluded.model,branch=excluded.branch,thread_id=excluded.thread_id,state=excluded.state,desired_state=excluded.desired_state,active_turn_id=excluded.active_turn_id,protocol_version=excluded.protocol_version,failure_count=excluded.failure_count,effective_skill_selection_json=excluded.effective_skill_selection_json,last_org_plan_json=excluded.last_org_plan_json,updated_at=excluded.updated_at')
15
- .run(session.id, session.workspaceId, session.workspacePath, session.profile, session.model ?? null, session.branch ?? null, session.threadId, session.state, session.desiredState, session.activeTurnId, session.protocolVersion, session.failureCount, session.effectiveSkillSelection === undefined
14
+ .prepare('INSERT INTO relay_sessions (id,workspace_id,workspace_path,profile,model,branch,thread_id,state,desired_state,active_turn_id,protocol_version,attention_tool_capability,failure_count,effective_skill_selection_json,last_org_plan_json,created_at,updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ON CONFLICT(id) DO UPDATE SET workspace_id=excluded.workspace_id,workspace_path=excluded.workspace_path,profile=excluded.profile,model=excluded.model,branch=excluded.branch,thread_id=excluded.thread_id,state=excluded.state,desired_state=excluded.desired_state,active_turn_id=excluded.active_turn_id,protocol_version=excluded.protocol_version,attention_tool_capability=excluded.attention_tool_capability,failure_count=excluded.failure_count,effective_skill_selection_json=excluded.effective_skill_selection_json,last_org_plan_json=excluded.last_org_plan_json,updated_at=excluded.updated_at')
15
+ .run(session.id, session.workspaceId, session.workspacePath, session.profile, session.model ?? null, session.branch ?? null, session.threadId, session.state, session.desiredState, session.activeTurnId, session.protocolVersion, session.attentionToolCapability ?? null, session.failureCount, session.effectiveSkillSelection === undefined
16
16
  ? null
17
17
  : JSON.stringify(session.effectiveSkillSelection), session.lastOrgPlan === undefined ? null : JSON.stringify(session.lastOrgPlan), session.createdAt, session.updatedAt);
18
18
  }
@@ -46,6 +46,9 @@ function map(row) {
46
46
  desiredState: row.desired_state,
47
47
  activeTurnId: row.active_turn_id,
48
48
  protocolVersion: row.protocol_version,
49
+ ...(row.attention_tool_capability === 'supported'
50
+ ? { attentionToolCapability: 'supported' }
51
+ : {}),
49
52
  failureCount: row.failure_count,
50
53
  ...(effectiveSkillSelection === undefined ? {} : { effectiveSkillSelection }),
51
54
  ...(lastOrgPlan === undefined ? {} : { lastOrgPlan }),
@@ -0,0 +1,101 @@
1
+ /*
2
+ * Copyright (C) 2026 Dyne.org foundation
3
+ * Designed by Denis Roio <jaromil@dyne.org>
4
+ * SPDX-License-Identifier: AGPL-3.0-or-later
5
+ */
6
+ /** Versioned, bounded contract consumed by supervised Org Plan roles. */
7
+ export const GESTALT_ORG_PLAN_ATTENTION_TOOL_NAME = 'gestalt_org_plan_attention';
8
+ export const orgPlanAttentionReasons = [
9
+ 'planChange',
10
+ 'hardBlock',
11
+ 'missingDependency',
12
+ 'permissionRequired',
13
+ 'externalState',
14
+ 'materialAmbiguity',
15
+ ];
16
+ export const orgPlanAttentionResumeConditions = [
17
+ 'userGuidance',
18
+ 'planRevision',
19
+ 'dependencyInstalled',
20
+ 'permissionGranted',
21
+ 'externalStateChanged',
22
+ ];
23
+ export const gestaltOrgPlanAttentionDynamicTool = {
24
+ type: 'function',
25
+ name: GESTALT_ORG_PLAN_ATTENTION_TOOL_NAME,
26
+ description: 'Declare a genuine, durable human-attention requirement for a supervised Org Plan. Use only when progress cannot continue safely without the requested bounded human action. Do not include error stacks, environment values, plan contents, or unbounded prose.',
27
+ inputSchema: {
28
+ type: 'object',
29
+ additionalProperties: false,
30
+ required: ['reason', 'summary', 'requestedAction', 'resumeCondition'],
31
+ properties: {
32
+ reason: { type: 'string', enum: orgPlanAttentionReasons },
33
+ summary: { type: 'string', minLength: 1, maxLength: 600 },
34
+ requestedAction: { type: 'string', minLength: 1, maxLength: 600 },
35
+ resumeCondition: { type: 'string', enum: orgPlanAttentionResumeConditions },
36
+ },
37
+ },
38
+ };
39
+ export function parseOrgPlanAttention(value) {
40
+ if (!isRecord(value) || Object.keys(value).length !== 4)
41
+ return null;
42
+ if (!isReason(value.reason) ||
43
+ !isBoundedText(value.summary, 600) ||
44
+ !isBoundedText(value.requestedAction, 600) ||
45
+ !isResumeCondition(value.resumeCondition))
46
+ return null;
47
+ return {
48
+ reason: value.reason,
49
+ summary: value.summary,
50
+ requestedAction: value.requestedAction,
51
+ resumeCondition: value.resumeCondition,
52
+ };
53
+ }
54
+ export function parseOrgPlanAttentionResponse(value) {
55
+ if (!isRecord(value) || !['resume', 'disableAutopilot'].includes(value.action))
56
+ return null;
57
+ if (Object.keys(value).some((key) => key !== 'action' && key !== 'guidance'))
58
+ return null;
59
+ if (value.guidance !== undefined && !isBoundedText(value.guidance, 1_000))
60
+ return null;
61
+ return {
62
+ action: value.action,
63
+ ...(typeof value.guidance === 'string' ? { guidance: value.guidance } : {}),
64
+ };
65
+ }
66
+ /** The only result accepted by the held app-server dynamic-tool request. */
67
+ export function toOrgPlanAttentionToolResponse(response) {
68
+ return {
69
+ success: true,
70
+ contentItems: [{ type: 'input_text', text: JSON.stringify(response) }],
71
+ };
72
+ }
73
+ export function isOrgPlanAttentionToolResponse(value) {
74
+ if (!isRecord(value) || value.success !== true || !Array.isArray(value.contentItems))
75
+ return false;
76
+ const item = value.contentItems[0];
77
+ if (value.contentItems.length !== 1 ||
78
+ !isRecord(item) ||
79
+ item.type !== 'input_text' ||
80
+ typeof item.text !== 'string')
81
+ return false;
82
+ try {
83
+ return parseOrgPlanAttentionResponse(JSON.parse(item.text)) !== null;
84
+ }
85
+ catch {
86
+ return false;
87
+ }
88
+ }
89
+ function isReason(value) {
90
+ return (typeof value === 'string' && orgPlanAttentionReasons.includes(value));
91
+ }
92
+ function isResumeCondition(value) {
93
+ return (typeof value === 'string' &&
94
+ orgPlanAttentionResumeConditions.includes(value));
95
+ }
96
+ function isBoundedText(value, maximum) {
97
+ return typeof value === 'string' && value.trim().length > 0 && value.length <= maximum;
98
+ }
99
+ function isRecord(value) {
100
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
101
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gestalt-mobile",
3
- "version": "0.17.2",
3
+ "version": "0.18.0",
4
4
  "description": "Mobile-first web relay for durable Codex development sessions",
5
5
  "keywords": [
6
6
  "codex",