@agentuity/opencode 0.1.43 → 0.1.45

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 (96) hide show
  1. package/README.md +9 -9
  2. package/dist/agents/architect.d.ts +1 -1
  3. package/dist/agents/architect.d.ts.map +1 -1
  4. package/dist/agents/architect.js +4 -0
  5. package/dist/agents/architect.js.map +1 -1
  6. package/dist/agents/builder.d.ts +1 -1
  7. package/dist/agents/builder.d.ts.map +1 -1
  8. package/dist/agents/builder.js +4 -0
  9. package/dist/agents/builder.js.map +1 -1
  10. package/dist/agents/expert.d.ts +1 -1
  11. package/dist/agents/expert.d.ts.map +1 -1
  12. package/dist/agents/expert.js +2 -2
  13. package/dist/agents/index.d.ts.map +1 -1
  14. package/dist/agents/index.js +4 -0
  15. package/dist/agents/index.js.map +1 -1
  16. package/dist/agents/lead.d.ts +1 -1
  17. package/dist/agents/lead.d.ts.map +1 -1
  18. package/dist/agents/lead.js +115 -11
  19. package/dist/agents/lead.js.map +1 -1
  20. package/dist/agents/memory/entities.d.ts +32 -0
  21. package/dist/agents/memory/entities.d.ts.map +1 -0
  22. package/dist/agents/memory/entities.js +168 -0
  23. package/dist/agents/memory/entities.js.map +1 -0
  24. package/dist/agents/memory/index.d.ts +4 -0
  25. package/dist/agents/memory/index.d.ts.map +1 -0
  26. package/dist/agents/memory/index.js +2 -0
  27. package/dist/agents/memory/index.js.map +1 -0
  28. package/dist/agents/memory/types.d.ts +71 -0
  29. package/dist/agents/memory/types.d.ts.map +1 -0
  30. package/dist/agents/memory/types.js +2 -0
  31. package/dist/agents/memory/types.js.map +1 -0
  32. package/dist/agents/memory.d.ts +1 -1
  33. package/dist/agents/memory.d.ts.map +1 -1
  34. package/dist/agents/memory.js +300 -7
  35. package/dist/agents/memory.js.map +1 -1
  36. package/dist/agents/product.d.ts +4 -0
  37. package/dist/agents/product.d.ts.map +1 -0
  38. package/dist/agents/product.js +333 -0
  39. package/dist/agents/product.js.map +1 -0
  40. package/dist/agents/reasoner.d.ts +16 -0
  41. package/dist/agents/reasoner.d.ts.map +1 -0
  42. package/dist/agents/reasoner.js +160 -0
  43. package/dist/agents/reasoner.js.map +1 -0
  44. package/dist/agents/reviewer.d.ts +1 -1
  45. package/dist/agents/reviewer.d.ts.map +1 -1
  46. package/dist/agents/reviewer.js +9 -0
  47. package/dist/agents/reviewer.js.map +1 -1
  48. package/dist/background/manager.js +1 -1
  49. package/dist/background/manager.js.map +1 -1
  50. package/dist/plugin/hooks/index.d.ts +2 -0
  51. package/dist/plugin/hooks/index.d.ts.map +1 -0
  52. package/dist/plugin/hooks/index.js +2 -0
  53. package/dist/plugin/hooks/index.js.map +1 -0
  54. package/dist/plugin/hooks/session-memory.d.ts.map +1 -1
  55. package/dist/plugin/hooks/session-memory.js +5 -0
  56. package/dist/plugin/hooks/session-memory.js.map +1 -1
  57. package/dist/plugin/hooks/tools.d.ts +11 -0
  58. package/dist/plugin/hooks/tools.d.ts.map +1 -1
  59. package/dist/plugin/hooks/tools.js +18 -1
  60. package/dist/plugin/hooks/tools.js.map +1 -1
  61. package/dist/plugin/plugin.d.ts.map +1 -1
  62. package/dist/plugin/plugin.js +175 -12
  63. package/dist/plugin/plugin.js.map +1 -1
  64. package/dist/tools/background.d.ts +2 -0
  65. package/dist/tools/background.d.ts.map +1 -1
  66. package/dist/tools/background.js +3 -3
  67. package/dist/tools/background.js.map +1 -1
  68. package/dist/tools/delegate.d.ts +4 -0
  69. package/dist/tools/delegate.d.ts.map +1 -1
  70. package/dist/tools/delegate.js +18 -3
  71. package/dist/tools/delegate.js.map +1 -1
  72. package/dist/types.d.ts +2 -0
  73. package/dist/types.d.ts.map +1 -1
  74. package/dist/types.js +2 -0
  75. package/dist/types.js.map +1 -1
  76. package/package.json +3 -3
  77. package/src/agents/architect.ts +4 -0
  78. package/src/agents/builder.ts +4 -0
  79. package/src/agents/expert.ts +2 -2
  80. package/src/agents/index.ts +4 -0
  81. package/src/agents/lead.ts +115 -11
  82. package/src/agents/memory/entities.ts +220 -0
  83. package/src/agents/memory/index.ts +22 -0
  84. package/src/agents/memory/types.ts +76 -0
  85. package/src/agents/memory.ts +300 -7
  86. package/src/agents/product.ts +336 -0
  87. package/src/agents/reasoner.ts +182 -0
  88. package/src/agents/reviewer.ts +9 -0
  89. package/src/background/manager.ts +1 -1
  90. package/src/plugin/hooks/index.ts +1 -0
  91. package/src/plugin/hooks/session-memory.ts +5 -0
  92. package/src/plugin/hooks/tools.ts +24 -1
  93. package/src/plugin/plugin.ts +200 -12
  94. package/src/tools/background.ts +3 -3
  95. package/src/tools/delegate.ts +18 -3
  96. package/src/types.ts +2 -0
@@ -1,11 +1,12 @@
1
1
  import type { PluginInput, Hooks } from '@opencode-ai/plugin';
2
2
  import { tool } from '@opencode-ai/plugin';
3
+ import { StructuredError } from '@agentuity/core';
3
4
  import type { AgentConfig, CommandDefinition } from '../types';
4
5
  import { loadAllSkills, type LoadedSkill } from '../skills';
5
6
  import { agents } from '../agents';
6
7
  import { loadCoderConfig, getDefaultConfig, mergeConfig, validateAndWarnConfigs } from '../config';
7
8
  import { createSessionHooks } from './hooks/session';
8
- import { createToolHooks } from './hooks/tools';
9
+ import { createToolHooks, getCoderProfile } from './hooks/tools';
9
10
  import { createKeywordHooks } from './hooks/keyword';
10
11
  import { createParamsHooks } from './hooks/params';
11
12
  import { createCadenceHooks } from './hooks/cadence';
@@ -13,6 +14,26 @@ import { createSessionMemoryHooks } from './hooks/session-memory';
13
14
  import type { AgentRole } from '../types';
14
15
  import { BackgroundManager } from '../background';
15
16
  import { TmuxSessionManager } from '../tmux';
17
+ import { checkAuth } from '../services/auth';
18
+
19
+ // ─────────────────────────────────────────────────────────────────────────────
20
+ // Memory Share Tool Errors
21
+ // ─────────────────────────────────────────────────────────────────────────────
22
+
23
+ const MemoryShareAuthError = StructuredError(
24
+ 'MemoryShareAuthError',
25
+ 'Authentication required to share memory content'
26
+ )<{ reason: string }>();
27
+
28
+ const MemoryShareCLIError = StructuredError(
29
+ 'MemoryShareCLIError',
30
+ 'CLI command failed to create stream'
31
+ )<{ exitCode: number; stderr: string }>();
32
+
33
+ const MemoryShareError = StructuredError(
34
+ 'MemoryShareError',
35
+ 'Failed to create public memory share'
36
+ )<{ reason: string }>();
16
37
 
17
38
  // Sandbox environment detection
18
39
  const SANDBOX_ID = process.env.AGENTUITY_SANDBOX_ID;
@@ -53,6 +74,8 @@ const AGENT_MENTIONS: Record<AgentRole, string> = {
53
74
  expert: '@Agentuity Coder Expert',
54
75
  planner: '@Agentuity Coder Planner',
55
76
  runner: '@Agentuity Coder Runner',
77
+ reasoner: '@Agentuity Coder Reasoner',
78
+ product: '@Agentuity Coder Product',
56
79
  };
57
80
 
58
81
  export async function createCoderPlugin(ctx: PluginInput): Promise<Hooks> {
@@ -278,21 +301,24 @@ You are the Agentuity Coder Lead agent orchestrating the Agentuity Coder team.
278
301
  - **@Agentuity Coder Architect**: Complex autonomous tasks, Cadence mode (GPT Codex)
279
302
  - **@Agentuity Coder Reviewer**: Review changes, catch issues, apply fixes
280
303
  - **@Agentuity Coder Memory**: Store context, remember decisions
304
+ - **@Agentuity Coder Reasoner**: Extract structured conclusions, resolve conflicts, surface corrections
281
305
  - **@Agentuity Coder Expert**: Agentuity CLI and cloud services specialist
282
306
  - **@Agentuity Coder Planner**: Deep planning for complex architecture decisions
283
307
  - **@Agentuity Coder Runner**: Run lint/build/test commands, returns structured results
308
+ - **@Agentuity Coder Product**: Clarify requirements, validate features, track progress
284
309
 
285
310
  ## Task
286
311
  $ARGUMENTS
287
312
 
288
313
  ## Guidelines
289
314
  1. Use @Agentuity Coder Scout first to understand context
290
- 2. Delegate implementation to @Agentuity Coder Builder (or Architect for complex work)
291
- 3. Delegate lint/build/test commands to @Agentuity Coder Runner for structured results
292
- 4. Have @Agentuity Coder Reviewer check the work
293
- 5. Use @Agentuity Coder Expert for Agentuity CLI questions
294
- 6. Only use cloud services when genuinely helpful
295
- 7. **When done, tell @Agentuity Coder Memory to memorialize the session**
315
+ 2. Use @Agentuity Coder Product to clarify requirements if unclear
316
+ 3. Delegate implementation to @Agentuity Coder Builder (or Architect for complex work)
317
+ 4. Delegate lint/build/test commands to @Agentuity Coder Runner for structured results
318
+ 5. Have @Agentuity Coder Reviewer check the work
319
+ 6. Use @Agentuity Coder Expert for Agentuity CLI questions
320
+ 7. Only use cloud services when genuinely helpful
321
+ 8. **When done, tell @Agentuity Coder Memory to memorialize the session**
296
322
  </coder-mode>`,
297
323
  agent: 'Agentuity Coder Lead',
298
324
  argumentHint: '"task description"',
@@ -316,6 +342,23 @@ $ARGUMENTS`,
316
342
  argumentHint: '(optional additional context)',
317
343
  },
318
344
 
345
+ 'agentuity-memory-share': {
346
+ name: 'agentuity-memory-share',
347
+ description: '🔗 Share memory content publicly with a shareable URL',
348
+ template: `User wants to share content publicly.
349
+
350
+ **You have current session context. Memory does not (unless given a session ID).**
351
+
352
+ - Current session → Handle directly: compile content, call \`agentuity_memory_share\`
353
+ - Stored content (specific ID, past work) → Delegate to Memory
354
+ - Long Cadence cycle? → Ask Memory for past compactions to include
355
+
356
+ User's request: $ARGUMENTS`,
357
+ agent: 'Agentuity Coder Lead',
358
+ argumentHint:
359
+ '"share a summary of this session" or "share the auth decisions with 1 hour TTL"',
360
+ },
361
+
319
362
  // ─────────────────────────────────────────────────────────────────────
320
363
  // Agentuity Cloud Service Commands
321
364
  // ─────────────────────────────────────────────────────────────────────
@@ -414,9 +457,11 @@ You are the Agentuity Coder Lead in **Cadence mode** — a long-running autonomo
414
457
  - **@Agentuity Coder Builder**: Quick fixes, simple changes (for minor iterations only)
415
458
  - **@Agentuity Coder Reviewer**: Review changes, catch issues, apply fixes
416
459
  - **@Agentuity Coder Memory**: Store context, remember decisions, checkpoints
460
+ - **@Agentuity Coder Reasoner**: Extract structured conclusions, resolve conflicts, surface corrections
417
461
  - **@Agentuity Coder Expert**: Agentuity CLI and cloud services specialist
418
462
  - **@Agentuity Coder Planner**: Deep planning for complex architecture decisions
419
463
  - **@Agentuity Coder Runner**: Run lint/build/test commands, returns structured results
464
+ - **@Agentuity Coder Product**: Clarify requirements, validate features, track progress, Cadence briefings
420
465
 
421
466
  ## Task
422
467
  $ARGUMENTS
@@ -503,8 +548,10 @@ Use this to:
503
548
  - Architect: Complex autonomous tasks, Cadence mode, deep reasoning (GPT Codex)
504
549
  - Reviewer: Review changes, catch issues, apply fixes
505
550
  - Memory: Store context, remember decisions across sessions
551
+ - Reasoner: Extract structured conclusions, resolve conflicts, surface corrections
506
552
  - Expert: Get help with Agentuity CLI and cloud services
507
- - Planner: Strategic advisor for complex architecture and deep planning (read-only)`,
553
+ - Planner: Strategic advisor for complex architecture and deep planning (read-only)
554
+ - Runner: Execute lint/build/test/typecheck/format commands, returns structured results`,
508
555
  args: {
509
556
  agent: s
510
557
  .enum([
@@ -513,6 +560,7 @@ Use this to:
513
560
  'architect',
514
561
  'reviewer',
515
562
  'memory',
563
+ 'reasoner',
516
564
  'expert',
517
565
  'planner',
518
566
  'runner',
@@ -547,9 +595,11 @@ IMPORTANT: Use this tool instead of the 'task' tool when:
547
595
  'architect',
548
596
  'reviewer',
549
597
  'memory',
598
+ 'reasoner',
550
599
  'expert',
551
600
  'planner',
552
601
  'runner',
602
+ 'product',
553
603
  ])
554
604
  .describe('Agent role to run the task'),
555
605
  task: s.string().describe('Task prompt to run in the background'),
@@ -622,11 +672,149 @@ IMPORTANT: Use this tool instead of the 'task' tool when:
622
672
  },
623
673
  });
624
674
 
675
+ const memoryShare = tool({
676
+ description: `Share memory content publicly via Agentuity Cloud Streams.
677
+
678
+ Creates a public URL that can be shared with anyone - no authentication required to access.
679
+ The content is stored in Agentuity's durable stream storage with optional TTL.
680
+
681
+ Use this when:
682
+ - User wants to share context with another agent/session
683
+ - User wants to export a summary, compaction, or session for external use
684
+ - User explicitly asks to "share" or "make public" some memory content
685
+
686
+ Returns the public URL that can be copied and used anywhere.`,
687
+ args: {
688
+ content: s.string().describe('The content to share publicly'),
689
+ namespace: s
690
+ .string()
691
+ .optional()
692
+ .describe('Stream namespace (default: agentuity-opencode-shares)'),
693
+ ttl_seconds: s
694
+ .number()
695
+ .optional()
696
+ .describe('TTL in seconds (60-7776000, or omit for 30-day default)'),
697
+ content_type: s.string().optional().describe('Content type (default: text/markdown)'),
698
+ metadata: s
699
+ .record(s.string(), s.string())
700
+ .optional()
701
+ .describe('Optional metadata key-value pairs'),
702
+ compress: s.boolean().optional().describe('Enable gzip compression'),
703
+ region: s.string().optional().describe('Cloud region (use, usc, usw). Default: usc'),
704
+ },
705
+ async execute(args) {
706
+ // Get the profile first - this ensures checkAuth() and CLI use the same profile
707
+ const profile = getCoderProfile();
708
+ const originalProfile = process.env.AGENTUITY_PROFILE;
709
+
710
+ try {
711
+ // Set profile before auth check so checkAuth reads the correct config
712
+ process.env.AGENTUITY_PROFILE = profile;
713
+
714
+ // Check auth first
715
+ const authResult = await checkAuth();
716
+ if (!authResult.ok) {
717
+ const err = new MemoryShareAuthError({ reason: authResult.error });
718
+ return JSON.stringify({
719
+ success: false,
720
+ error: err.message,
721
+ errorTag: err._tag,
722
+ details: { reason: authResult.error },
723
+ });
724
+ }
725
+
726
+ // Build CLI command
727
+ const namespace = args.namespace ?? 'agentuity-opencode-shares';
728
+ const contentType = args.content_type ?? 'text/markdown';
729
+
730
+ const cliArgs = ['agentuity', '--json', 'cloud', 'stream', 'create', namespace, '-'];
731
+ cliArgs.push('--content-type', contentType);
732
+ cliArgs.push('--region', args.region ?? 'usc');
733
+
734
+ if (args.ttl_seconds !== undefined) {
735
+ cliArgs.push('--ttl', String(args.ttl_seconds));
736
+ }
737
+
738
+ if (args.compress) {
739
+ cliArgs.push('--compress');
740
+ }
741
+
742
+ if (args.metadata && Object.keys(args.metadata).length > 0) {
743
+ const metadataStr = Object.entries(args.metadata)
744
+ .map(([k, v]) => `${k}=${v}`)
745
+ .join(',');
746
+ cliArgs.push('--metadata', metadataStr);
747
+ }
748
+ const proc = Bun.spawn(cliArgs, {
749
+ stdin: 'pipe',
750
+ stdout: 'pipe',
751
+ stderr: 'pipe',
752
+ env: {
753
+ ...process.env,
754
+ AGENTUITY_PROFILE: profile,
755
+ },
756
+ });
757
+
758
+ // Write content to stdin (Bun's FileSink API)
759
+ proc.stdin.write(new TextEncoder().encode(args.content));
760
+ proc.stdin.end();
761
+
762
+ const [stdout, stderr, exitCode] = await Promise.all([
763
+ new Response(proc.stdout).text(),
764
+ new Response(proc.stderr).text(),
765
+ proc.exited,
766
+ ]);
767
+
768
+ if (exitCode !== 0) {
769
+ const err = new MemoryShareCLIError({
770
+ exitCode,
771
+ stderr: stderr || `CLI exited with code ${exitCode}`,
772
+ });
773
+ return JSON.stringify({
774
+ success: false,
775
+ error: err.message,
776
+ errorTag: err._tag,
777
+ details: { exitCode, stderr },
778
+ });
779
+ }
780
+
781
+ // Parse JSON response from CLI
782
+ const result = JSON.parse(stdout);
783
+
784
+ return JSON.stringify({
785
+ success: true,
786
+ url: result.url,
787
+ id: result.id,
788
+ namespace: result.namespace,
789
+ sizeBytes: result.sizeBytes,
790
+ expiresAt: result.expiresAt,
791
+ });
792
+ } catch (error) {
793
+ const reason = error instanceof Error ? error.message : 'Failed to create stream';
794
+ const err = new MemoryShareError({ reason });
795
+ return JSON.stringify({
796
+ success: false,
797
+ error: err.message,
798
+ errorTag: err._tag,
799
+ details: { reason },
800
+ });
801
+ } finally {
802
+ // Restore original profile
803
+ if (originalProfile !== undefined) {
804
+ process.env.AGENTUITY_PROFILE = originalProfile;
805
+ } else {
806
+ delete process.env.AGENTUITY_PROFILE;
807
+ }
808
+ }
809
+ },
810
+ });
811
+
625
812
  return {
626
- coder_delegate: coderDelegate,
627
- background_task: backgroundTask,
628
- background_output: backgroundOutput,
629
- background_cancel: backgroundCancel,
813
+ agentuity_coder_delegate: coderDelegate,
814
+ agentuity_background_task: backgroundTask,
815
+ agentuity_background_output: backgroundOutput,
816
+ agentuity_background_cancel: backgroundCancel,
817
+ agentuity_memory_share: memoryShare,
630
818
  };
631
819
  }
632
820
 
@@ -60,7 +60,7 @@ export function createBackgroundTools(manager: BackgroundManager): {
60
60
  };
61
61
  } {
62
62
  const backgroundTaskTool = {
63
- name: 'background_task',
63
+ name: 'agentuity_background_task',
64
64
  description: 'Launch a task to run in the background.',
65
65
  args: BackgroundTaskArgsSchema,
66
66
  async execute(
@@ -92,7 +92,7 @@ export function createBackgroundTools(manager: BackgroundManager): {
92
92
  };
93
93
 
94
94
  const backgroundOutputTool = {
95
- name: 'background_output',
95
+ name: 'agentuity_background_output',
96
96
  description: 'Retrieve output for a background task.',
97
97
  args: BackgroundOutputArgsSchema,
98
98
  async execute(args: BackgroundOutputArgs): Promise<{
@@ -119,7 +119,7 @@ export function createBackgroundTools(manager: BackgroundManager): {
119
119
  };
120
120
 
121
121
  const backgroundCancelTool = {
122
- name: 'background_cancel',
122
+ name: 'agentuity_background_cancel',
123
123
  description: 'Cancel a running background task.',
124
124
  args: BackgroundCancelArgsSchema,
125
125
  async execute(args: BackgroundCancelArgs): Promise<{
@@ -4,7 +4,18 @@ import type { AgentRole } from '../types';
4
4
  // Schema for the delegate tool
5
5
  export const DelegateArgsSchema = z.object({
6
6
  agent: z
7
- .enum(['scout', 'builder', 'architect', 'reviewer', 'memory', 'expert', 'planner', 'runner'])
7
+ .enum([
8
+ 'scout',
9
+ 'builder',
10
+ 'architect',
11
+ 'reviewer',
12
+ 'memory',
13
+ 'reasoner',
14
+ 'expert',
15
+ 'planner',
16
+ 'runner',
17
+ 'product',
18
+ ])
8
19
  .describe('The agent to delegate to'),
9
20
  task: z.string().describe('Clear description of the task to delegate'),
10
21
  context: z.string().optional().describe('Additional context from previous tasks'),
@@ -27,21 +38,25 @@ const AGENT_MENTIONS: Record<AgentRole, string> = {
27
38
  expert: '@Agentuity Coder Expert',
28
39
  planner: '@Agentuity Coder Planner',
29
40
  runner: '@Agentuity Coder Runner',
41
+ reasoner: '@Agentuity Coder Reasoner',
42
+ product: '@Agentuity Coder Product',
30
43
  };
31
44
 
32
45
  export const delegateTool = {
33
- name: 'coder_delegate',
46
+ name: 'agentuity_coder_delegate',
34
47
  description: `Delegate a task to a specialized Agentuity Coder agent.
35
48
 
36
49
  Use this to:
37
50
  - Scout: Explore codebase, find patterns, research documentation
38
51
  - Builder: Implement features, write code, run tests (interactive work)
39
52
  - Architect: Complex autonomous tasks, Cadence mode, deep reasoning (GPT Codex)
40
- - Reviewer: Review changes, catch issues, apply fixes
53
+ - Reviewer: Review changes, catch issues, apply fixes
41
54
  - Memory: Store context, remember decisions across sessions
55
+ - Reasoner: Extract structured conclusions, resolve conflicts, surface corrections
42
56
  - Expert: Get help with Agentuity CLI and cloud services
43
57
  - Planner: Strategic advisor for complex architecture and deep planning (read-only)
44
58
  - Runner: Run lint/build/test/typecheck/format/clean/install commands, returns structured results
59
+ - Product: Drive clarity on requirements, validate features, track progress, Cadence briefings
45
60
 
46
61
  The task will be executed by the specified agent and the result returned.`,
47
62
 
package/src/types.ts CHANGED
@@ -25,6 +25,8 @@ export const AgentRoleSchema = z.enum([
25
25
  'expert',
26
26
  'planner',
27
27
  'runner',
28
+ 'reasoner',
29
+ 'product',
28
30
  ]);
29
31
  export type AgentRole = z.infer<typeof AgentRoleSchema>;
30
32