@spoons-and-mirrors/iam 0.1.1 → 0.1.2

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.
package/README.md CHANGED
@@ -1,43 +1,21 @@
1
1
  # IAM Plugin for OpenCode
2
2
 
3
- Inter-agent messaging for parallel subagents.
3
+ Lets parallel subagents talk to each other. No configuration needed — just install and it works.
4
4
 
5
- ## The `iam` Tool
5
+ ## What It Does
6
6
 
7
- | Action | Parameters | Description |
8
- |--------|------------|-------------|
9
- | `announce` | `message` | Announce what you're working on |
10
- | `sessions` | - | List agents and what they're working on |
11
- | `read` | - | Read your messages (marks as read) |
12
- | `write` | `to`, `message` | Send a message |
13
-
14
- ## Examples
15
-
16
- ```
17
- iam(action="announce", message="Implementing user authentication")
18
- iam(action="sessions")
19
- iam(action="read")
20
- iam(action="write", to="agentA", message="What approach are you using?")
21
- ```
7
+ When you spawn multiple agents with the `task` tool, they can:
8
+ - **Announce** what they're working on
9
+ - **Discover** other agents and see what they're doing
10
+ - **Message** each other to coordinate work
11
+ - Get **notified** when new messages arrive
22
12
 
23
13
  ## How It Works
24
14
 
25
- - **In-memory** - fast, no file clutter, resets on restart
26
- - **Auto-discovery** - agents register on first iam use, see each other immediately
27
- - **Simple aliases** - agents get friendly names (agentA, agentB, ...) instead of session IDs
28
- - **Urgent alerts** - recipients get `<system-reminder>` when they have unread mail
29
-
30
- ## Files
15
+ Agents get friendly names (agentA, agentB, ...) and automatically discover each other. When an agent has unread messages, they get an urgent notification.
31
16
 
32
- ```
33
- iam/
34
- ├── index.ts # Plugin + tool + hooks
35
- ├── prompt.ts # LLM-facing prompts
36
- ├── logger.ts # Logs to .logs/iam.log
37
- ├── PROGRESS.md # Development history
38
- └── README.md
39
- ```
17
+ The system lives in memory — fast, no file clutter, resets on restart.
40
18
 
41
- ## Logs
19
+ ## Debug Logs
42
20
 
43
- Debug logs written to `.logs/iam.log` (clears on restart). Shows all tool calls, messages sent, sessions registered, and notifications injected.
21
+ For troubleshooting, check `.logs/iam.log` (clears on restart). Shows all tool calls, messages, and notifications.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAiJjD,QAAA,MAAM,MAAM,EAAE,MAmKb,CAAA;AAED,eAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAkJjD,QAAA,MAAM,MAAM,EAAE,MAyKb,CAAA;AAED,eAAe,MAAM,CAAA"}
package/dist/index.js CHANGED
@@ -53,10 +53,23 @@ function readResult(messages, unreadCount) {
53
53
  var WRITE_MISSING_TO = `Error: 'to' parameter is required for action="write".`;
54
54
  var WRITE_MISSING_MESSAGE = `Error: 'message' parameter is required for action="write".`;
55
55
  var ANNOUNCE_MISSING_MESSAGE = `Error: 'message' parameter is required for action="announce". Describe what you're working on.`;
56
- function announceResult(alias) {
57
- return `Announced! Other agents will see your description when they list sessions.
58
-
59
- You are: ${alias}`;
56
+ function announceResult(alias, parallelAgents) {
57
+ const lines = [`Announced! Other agents will see your description when they list sessions.`, ``, `You are: ${alias}`];
58
+ if (parallelAgents.length > 0) {
59
+ lines.push(``);
60
+ lines.push(`--- Parallel Agents ---`);
61
+ for (const agent of parallelAgents) {
62
+ if (agent.description) {
63
+ lines.push(`• ${agent.alias} is working on: ${agent.description}`);
64
+ } else {
65
+ lines.push(`• ${agent.alias} is running (hasn't announced yet)`);
66
+ }
67
+ }
68
+ lines.push(``);
69
+ lines.push(`Use action="write" to coordinate with them if needed.`);
70
+ }
71
+ return lines.join(`
72
+ `);
60
73
  }
61
74
  function writeUnknownRecipient(to, known) {
62
75
  const list = known.length > 0 ? `Known agents: ${known.join(", ")}` : "No agents available yet.";
@@ -277,7 +290,11 @@ var plugin = async () => {
277
290
  }
278
291
  setDescription(sessionId, args.message);
279
292
  const alias = getAlias(sessionId);
280
- return announceResult(alias);
293
+ const parallelAgents = getKnownAgents(sessionId).map((agentAlias) => ({
294
+ alias: agentAlias,
295
+ description: getDescription(agentAlias)
296
+ }));
297
+ return announceResult(alias, parallelAgents);
281
298
  }
282
299
  default:
283
300
  return unknownAction(args.action);
@@ -334,7 +351,7 @@ var plugin = async () => {
334
351
  }
335
352
  };
336
353
  };
337
- var inbox_default = plugin;
354
+ var iam_default = plugin;
338
355
  export {
339
- inbox_default as default
356
+ iam_default as default
340
357
  };
package/dist/prompt.d.ts CHANGED
@@ -19,7 +19,11 @@ export declare function readResult(messages: {
19
19
  export declare const WRITE_MISSING_TO = "Error: 'to' parameter is required for action=\"write\".";
20
20
  export declare const WRITE_MISSING_MESSAGE = "Error: 'message' parameter is required for action=\"write\".";
21
21
  export declare const ANNOUNCE_MISSING_MESSAGE = "Error: 'message' parameter is required for action=\"announce\". Describe what you're working on.";
22
- export declare function announceResult(alias: string): string;
22
+ export interface ParallelAgent {
23
+ alias: string;
24
+ description?: string;
25
+ }
26
+ export declare function announceResult(alias: string, parallelAgents: ParallelAgent[]): string;
23
27
  export declare function writeUnknownRecipient(to: string, known: string[]): string;
24
28
  export declare function writeResult(to: string, messageId: string): string;
25
29
  export declare function unknownAction(action: string): string;
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../prompt.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,2XAMgD,CAAC;AAE9E,eAAO,MAAM,gBAAgB;;;;CAInB,CAAC;AAMX,eAAO,MAAM,cAAc,0JAIS,CAAC;AAErC,wBAAgB,cAAc,CAAC,MAAM,EAAE;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAC,EAAE,GAAG,MAAM,CAYtF;AAED,eAAO,MAAM,UAAU,mCAAmC,CAAC;AAE3D,wBAAg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AC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAC,EAAE,EAC1E,WAAW,EAAE,MAAM,GAClB,MAAM,CAiBR;AAED,eAAO,MAAM,gBAAgB,4DAA0D,CAAC;AACxF,eAAO,MAAM,qBAAqB,iEAA+D,CAAC;AAClG,eAAO,MAAM,wBAAwB,qGAAmG,CAAC;AAEzI,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,GAAG,MAAM,CAkBrF;AAED,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAMzE;AAED,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD;AAMD,eAAO,MAAM,aAAa,mkBAezB,CAAC;AAMF,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAK9D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spoons-and-mirrors/iam",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Inter-agent messaging for OpenCode parallel subagents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",