@jungjaehoon/mama-os 0.68.0 → 0.68.1

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/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.68.1] - 2026-10-07
9
+
10
+ ### Fixed
11
+
12
+ - `mama register-owner` binds every ID in `telegram.owner_user_ids` to the owner principal instead
13
+ of refusing more than one; a conflict on any of them writes nothing.
14
+
8
15
  ## [0.68.0] - 2026-10-07
9
16
 
10
17
  ### Added
package/README.md CHANGED
@@ -4,7 +4,7 @@ One owner agent on Claude or Codex watches connected work, keeps task revisions
4
4
  answers on Telegram, publishes reports and a board, and recalls corrections.
5
5
  [mama-core](../mama-core/README.md) supplies the shared engine.
6
6
 
7
- Current manifest: **0.68.0**. Install with `npm install -g @jungjaehoon/mama-os` (Node.js 22.13+)
7
+ Current manifest: **0.68.1**. Install with `npm install -g @jungjaehoon/mama-os` (Node.js 22.13+)
8
8
  and follow [owner setup](../../docs/start/owner-setup.md).
9
9
 
10
10
  ## Start and operate
@@ -1 +1 @@
1
- {"version":3,"file":"register-owner.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/register-owner.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,wBAAwB,CAAC;AAMhC,KAAK,WAAW,GAAG,UAAU,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAAC;AAElE,iGAAiG;AACjG,wBAAsB,gBAAgB,CACpC,IAAI,GAAE,SAAS,MAAM,EAAO,EAC5B,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GACnD,OAAO,CAAC,WAAW,CAAC,CAoCtB"}
1
+ {"version":3,"file":"register-owner.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/register-owner.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,wBAAwB,CAAC;AAMhC,KAAK,WAAW,GAAG,UAAU,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAAC;AAKlE,iGAAiG;AACjG,wBAAsB,gBAAgB,CACpC,IAAI,GAAE,SAAS,MAAM,EAAO,EAC5B,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GACnD,OAAO,CAAC,WAAW,CAAC,CAmDtB"}
@@ -6,40 +6,57 @@ const mama_core_1 = require("@jungjaehoon/mama-core");
6
6
  const config_js_1 = require("../../runtime/config.js");
7
7
  const prompt_js_1 = require("../prompt.js");
8
8
  const daemon_js_1 = require("./daemon.js");
9
+ /** Rolls back every binding when one owner id belongs to someone else. */
10
+ class OwnerConflict extends Error {
11
+ }
9
12
  /** Register against the daemon's existing schema, without starting its runtime or collectors. */
10
13
  async function runRegisterOwner(args = [], options = {}) {
11
14
  if (args.length !== 0)
12
15
  throw new prompt_js_1.CliInputError('Usage: mama register-owner');
13
16
  const home = options.home ?? (0, node_os_1.homedir)();
14
17
  const config = (0, config_js_1.loadConfig)({ home, ...(options.configPath ? { path: options.configPath } : {}) });
15
- // The ids the gateway admits as the owner, including the one config derives from a single
16
- // allowed chat. Several ids would be several senders, not one identity.
17
- if (config.telegram.owner_user_ids.length !== 1) {
18
- throw new prompt_js_1.CliInputError('telegram.owner_user_ids must contain exactly one user id');
18
+ // Every id the gateway admits as the owner (explicit, or derived from a single allowed chat) is
19
+ // an identity of the one owner, so each binds to the owner principal. An id bound to anyone else
20
+ // is a conflict, and then nothing is written.
21
+ const ownerIds = config.telegram.owner_user_ids;
22
+ if (ownerIds.length === 0) {
23
+ throw new prompt_js_1.CliInputError('telegram.owner_user_ids must contain at least one user id');
19
24
  }
20
25
  const adapter = (0, mama_core_1.createAdapter)({ dbPath: config.database.path });
21
- let receipt;
26
+ let result;
27
+ let counts;
22
28
  try {
23
29
  adapter.connect();
24
- receipt = adapter.transaction(() => {
25
- const result = (0, mama_core_1.createPrincipalRepository)(adapter).ensureOwner({
26
- principalId: daemon_js_1.OWNER_PRINCIPAL_ID,
27
- connector: 'telegram',
28
- namespace: 'private',
29
- externalId: config.telegram.owner_user_ids[0],
30
- now: Date.now(),
30
+ try {
31
+ result = adapter.transaction(() => {
32
+ const repository = (0, mama_core_1.createPrincipalRepository)(adapter);
33
+ const now = Date.now();
34
+ const results = ownerIds.map((externalId) => repository.ensureOwner({
35
+ principalId: daemon_js_1.OWNER_PRINCIPAL_ID,
36
+ connector: 'telegram',
37
+ namespace: 'private',
38
+ externalId,
39
+ now,
40
+ }));
41
+ if (results.includes('conflict'))
42
+ throw new OwnerConflict();
43
+ return results.includes('created') ? 'created' : 'exists';
31
44
  });
32
- const principals = adapter.prepare('SELECT COUNT(*) AS count FROM principals').get();
33
- const identities = adapter
34
- .prepare('SELECT COUNT(*) AS count FROM external_identities')
35
- .get();
36
- return { result, principals: principals.count, identities: identities.count };
37
- });
45
+ }
46
+ catch (error) {
47
+ if (!(error instanceof OwnerConflict))
48
+ throw error;
49
+ result = 'conflict';
50
+ }
51
+ counts = {
52
+ principals: adapter.prepare('SELECT COUNT(*) AS count FROM principals').get().count,
53
+ identities: adapter.prepare('SELECT COUNT(*) AS count FROM external_identities').get().count,
54
+ };
38
55
  }
39
56
  finally {
40
57
  adapter.disconnect();
41
58
  }
42
- console.log(`${receipt.result} principals=${receipt.principals} identities=${receipt.identities}`);
43
- return receipt.result;
59
+ console.log(`${result} principals=${counts.principals} identities=${counts.identities}`);
60
+ return result;
44
61
  }
45
62
  //# sourceMappingURL=register-owner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"register-owner.js","sourceRoot":"","sources":["../../../src/cli/commands/register-owner.ts"],"names":[],"mappings":";;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QACtB,CAAC;QACD,MAAM,GAAG;YACP,UAAU,EACR,OAAO,CAAC,OAAO,CAAC,0CAA0C,CAAC,CAAC,GAAG,EAChE,CAAC,KAAK;YACP,UAAU,EACR,OAAO,CAAC,OAAO,CAAC,mDAAmD,CAAC,CAAC,GAAG,EAGzE,CAAC,KAAK;SACR,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,UAAU,EAAE,CAAC;IACvB,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,eAAe,MAAM,CAAC,UAAU,eAAe,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;IACzF,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jungjaehoon/mama-os",
3
- "version": "0.68.0",
3
+ "version": "0.68.1",
4
4
  "description": "MAMA OS - The local work agent behind your messenger.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",