aicommunicator 0.0.0-stage → 0.2.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 (97) hide show
  1. package/LICENSE +55 -0
  2. package/README.md +93 -2
  3. package/bin/aic.js +20427 -0
  4. package/host-ui/host.js +5151 -0
  5. package/host-ui/index.html +483 -0
  6. package/host-ui/lang-en.js +631 -0
  7. package/package.json +30 -4
  8. package/plugin-guide.md +997 -0
  9. package/plugins/plugin-animation/LICENSE +55 -0
  10. package/plugins/plugin-animation/dist/logic.js +2225 -0
  11. package/plugins/plugin-animation/docs/manual.md +217 -0
  12. package/plugins/plugin-animation/manifest.json +31 -0
  13. package/plugins/plugin-animation/ui/icon.svg +6 -0
  14. package/plugins/plugin-animation/ui/index.html +2266 -0
  15. package/plugins/plugin-html-design/LICENSE +55 -0
  16. package/plugins/plugin-html-design/dist/logic.js +972 -0
  17. package/plugins/plugin-html-design/docs/manual.md +100 -0
  18. package/plugins/plugin-html-design/manifest.json +39 -0
  19. package/plugins/plugin-html-design/samples/exhibition-page.json +570 -0
  20. package/plugins/plugin-html-design/ui/icon.svg +5 -0
  21. package/plugins/plugin-html-design/ui/index.html +1241 -0
  22. package/plugins/plugin-html-slides/LICENSE +55 -0
  23. package/plugins/plugin-html-slides/dist/logic.js +1323 -0
  24. package/plugins/plugin-html-slides/docs/manual.md +121 -0
  25. package/plugins/plugin-html-slides/manifest.json +39 -0
  26. package/plugins/plugin-html-slides/samples/first-week-lecture.json +1129 -0
  27. package/plugins/plugin-html-slides/ui/icon.svg +5 -0
  28. package/plugins/plugin-html-slides/ui/index.html +1349 -0
  29. package/plugins/plugin-mindmap/LICENSE +55 -0
  30. package/plugins/plugin-mindmap/dist/logic.js +966 -0
  31. package/plugins/plugin-mindmap/docs/manual.md +145 -0
  32. package/plugins/plugin-mindmap/manifest.json +39 -0
  33. package/plugins/plugin-mindmap/samples/book-club.json +480 -0
  34. package/plugins/plugin-mindmap/ui/icon.svg +5 -0
  35. package/plugins/plugin-mindmap/ui/index.html +1774 -0
  36. package/plugins/plugin-plan/LICENSE +55 -0
  37. package/plugins/plugin-plan/dist/logic.js +1029 -0
  38. package/plugins/plugin-plan/docs/manual.md +261 -0
  39. package/plugins/plugin-plan/manifest.json +51 -0
  40. package/plugins/plugin-plan/samples/kimchi-day.json +1514 -0
  41. package/plugins/plugin-plan/samples/meeting-outline.json +653 -0
  42. package/plugins/plugin-plan/samples/reading-class.json +1577 -0
  43. package/plugins/plugin-plan/ui/icon.svg +7 -0
  44. package/plugins/plugin-plan/ui/index.html +1523 -0
  45. package/plugins/plugin-png/LICENSE +55 -0
  46. package/plugins/plugin-png/dist/logic.js +1758 -0
  47. package/plugins/plugin-png/docs/manual.md +344 -0
  48. package/plugins/plugin-png/manifest.json +35 -0
  49. package/plugins/plugin-png/ui/icon.svg +5 -0
  50. package/plugins/plugin-png/ui/index.html +2885 -0
  51. package/plugins/plugin-process-log/LICENSE +55 -0
  52. package/plugins/plugin-process-log/dist/logic.js +406 -0
  53. package/plugins/plugin-process-log/docs/manual.md +131 -0
  54. package/plugins/plugin-process-log/manifest.json +43 -0
  55. package/plugins/plugin-process-log/samples/design-decisions.json +241 -0
  56. package/plugins/plugin-process-log/ui/icon.svg +7 -0
  57. package/plugins/plugin-process-log/ui/index.html +721 -0
  58. package/plugins/plugin-story/LICENSE +55 -0
  59. package/plugins/plugin-story/dist/logic.js +2201 -0
  60. package/plugins/plugin-story/docs/manual.md +428 -0
  61. package/plugins/plugin-story/manifest.json +49 -0
  62. package/plugins/plugin-story/samples/scene-body.json +758 -0
  63. package/plugins/plugin-story/samples/time-and-groups.json +989 -0
  64. package/plugins/plugin-story/ui/icon.svg +4 -0
  65. package/plugins/plugin-story/ui/index.html +2783 -0
  66. package/plugins/plugin-svg/LICENSE +55 -0
  67. package/plugins/plugin-svg/dist/logic.js +2150 -0
  68. package/plugins/plugin-svg/docs/manual.md +314 -0
  69. package/plugins/plugin-svg/manifest.json +45 -0
  70. package/plugins/plugin-svg/samples/rocket-icon.json +1305 -0
  71. package/plugins/plugin-svg/samples/yard-cat.json +7796 -0
  72. package/plugins/plugin-svg/ui/icon.svg +4 -0
  73. package/plugins/plugin-svg/ui/index.html +2017 -0
  74. package/plugins/plugin-tree/LICENSE +55 -0
  75. package/plugins/plugin-tree/dist/logic.js +505 -0
  76. package/plugins/plugin-tree/docs/manual.md +140 -0
  77. package/plugins/plugin-tree/manifest.json +45 -0
  78. package/plugins/plugin-tree/samples/book-club.json +473 -0
  79. package/plugins/plugin-tree/samples/sort-memos.json +604 -0
  80. package/plugins/plugin-tree/ui/icon.svg +7 -0
  81. package/plugins/plugin-tree/ui/index.html +1305 -0
  82. package/schema/aic_describe.input.json +11 -0
  83. package/schema/aic_describe.output.json +67 -0
  84. package/schema/aic_observe.input.json +14 -0
  85. package/schema/aic_observe.output.json +47 -0
  86. package/schema/aic_send.input.json +15 -0
  87. package/schema/aic_send.output.json +38 -0
  88. package/schema/aic_update.input.json +19 -0
  89. package/schema/aic_update.output.json +39 -0
  90. package/schema/common.json +127 -0
  91. package/template/plugin/LICENSE +55 -0
  92. package/template/plugin/README.md +27 -0
  93. package/template/plugin/docs/manual.md +31 -0
  94. package/template/plugin/logic.js +337 -0
  95. package/template/plugin/manifest.json +27 -0
  96. package/template/plugin/ui/icon.svg +4 -0
  97. package/template/plugin/ui/index.html +269 -0
@@ -0,0 +1,55 @@
1
+ Apache License
2
+
3
+ Version 2.0, January 2004
4
+
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
16
+
17
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
18
+
19
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
20
+
21
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
22
+
23
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
24
+
25
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
26
+
27
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
28
+
29
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
30
+
31
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
32
+
33
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
34
+
35
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
36
+
37
+ You must give any other recipients of the Work or Derivative Works a copy of this License; and
38
+
39
+ You must cause any modified files to carry prominent notices stating that You changed the files; and
40
+
41
+ You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
42
+
43
+ If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
44
+
45
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
46
+
47
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
48
+
49
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
50
+
51
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
52
+
53
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
54
+
55
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,406 @@
1
+ "use strict";
2
+ (() => {
3
+ // packages/plugin-process-log/src/logic.ts
4
+ var PACKAGE_ID = "aic.process-log";
5
+ var VERSION = "0.1.5";
6
+ var TYPE = "log";
7
+ var PREFIX = "lg";
8
+ var LIMITS = { title: 200, decided: 4e3, why: 4e3, code: 2e4 };
9
+ var FIELDS = ["title", "decided", "why", "code"];
10
+ var REQUIRED = /* @__PURE__ */ new Set(["title", "decided"]);
11
+ var FIELD_NAME = { title: "title", decided: "decision", why: "reason", code: "code" };
12
+ var SHORTEN = {
13
+ title: "Shorten the title to a one-line name and put the details in decided",
14
+ decided: "If there is more than one decision, split it into several memos, and put code in the code field",
15
+ why: "Keep only the core of the reason",
16
+ code: "Keep only the changed part or the key part instead of all the code"
17
+ };
18
+ var STEP = 1024;
19
+ var Reject = class extends Error {
20
+ constructor(code, message) {
21
+ super(message);
22
+ this.code = code;
23
+ }
24
+ code;
25
+ };
26
+ var chars = (s) => [...s].length;
27
+ var idNumber = (id) => Number(id.replace(/\D/g, "") || "0");
28
+ var orderOf = (r) => r.content.order;
29
+ var byOrder = (a, b) => orderOf(a) - orderOf(b) || idNumber(a.id) - idNumber(b.id) || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0);
30
+ var logsOf = (s) => Object.values(s.records).filter((r) => r.type === TYPE).sort(byOrder);
31
+ var log = (s, id) => s.records[id].content;
32
+ function contentOf(v) {
33
+ return { title: v.title, decided: v.decided, ...v.why ? { why: v.why } : {}, ...v.code ? { code: v.code } : {}, order: v.order };
34
+ }
35
+ function inputObject(raw) {
36
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) throw new Reject("INVALID_INPUT", "input must be an object of field names and values");
37
+ return raw;
38
+ }
39
+ function onlyFields(input, op, allowed) {
40
+ const extra = Object.keys(input).filter((k) => !allowed.includes(k));
41
+ if (extra.length) throw new Reject("INVALID_INPUT", `${op} has unknown fields: ${extra.join(", ")}. The fields you can use are ${allowed.join(", ")}`);
42
+ }
43
+ function textInput(input, field, ctx) {
44
+ const v = input[field];
45
+ const required = REQUIRED.has(field);
46
+ if (v === void 0) return void 0;
47
+ if (v === null) {
48
+ if (required) throw new Reject("INVALID_INPUT", `${field} cannot be cleared. Give text`);
49
+ return null;
50
+ }
51
+ if (typeof v !== "string") throw new Reject("INVALID_INPUT", `${field} must be text. It was ${Array.isArray(v) ? "a list" : `a ${typeof v}`}`);
52
+ const lf = v.replace(/\r\n?/g, "\n");
53
+ const t = field === "code" ? lf.replace(/^(?:[ \t]*\n)+/, "").trimEnd() : lf.trim();
54
+ if (t === "") {
55
+ if (required) throw new Reject("INVALID_INPUT", `${field} is empty. Give text`);
56
+ return null;
57
+ }
58
+ if (field === "title" && t.includes("\n")) throw new Reject("INVALID_INPUT", "Write title on one line. Remove the line breaks and put the details in decided");
59
+ const n = chars(t);
60
+ if (n > LIMITS[field]) throw new Reject("INVALID_INPUT", `${field} is ${n} characters, over the limit of ${LIMITS[field]}. ${SHORTEN[field]}`);
61
+ if (ctx.tempNames.includes(t)) throw new Reject("INVALID_INPUT", `"${t}" in ${field} is the same as a temporary name in this request, so it cannot be used as text`);
62
+ return t;
63
+ }
64
+ function need(s, id) {
65
+ if (typeof id !== "string" || id === "") throw new Reject("INVALID_INPUT", "log needs a memo id. Give an id such as (lg1) from read_concept");
66
+ const r = s.records[id];
67
+ if (!r) throw new Reject("TARGET_NOT_FOUND", `Memo ${id} was not found. Read the memo ids again with read_concept`);
68
+ if (r.type !== TYPE) throw new Reject("INVALID_INPUT", `${id} is not a process memo`);
69
+ return r;
70
+ }
71
+ function orderAt(list, index) {
72
+ const left = index > 0 ? orderOf(list[index - 1]) : null;
73
+ const right = index < list.length ? orderOf(list[index]) : null;
74
+ const safe = (x) => Number.isSafeInteger(x) ? x : null;
75
+ if (left === null && right === null) return STEP;
76
+ if (right === null) return safe(left + STEP);
77
+ if (left === null) return safe(right - STEP);
78
+ return right - left >= 2 ? Math.floor((left + right) / 2) : null;
79
+ }
80
+ function placed(list, index, self, content) {
81
+ const at = orderAt(list, index);
82
+ if (at !== null) return [{ ...self, after: contentOf({ ...content, order: at }) }];
83
+ const out = [];
84
+ [...list.slice(0, index), null, ...list.slice(index)].forEach((r, i) => {
85
+ const order = STEP * (i + 1);
86
+ if (r === null) out.push({ ...self, after: contentOf({ ...content, order }) });
87
+ else if (orderOf(r) !== order) out.push({ id: r.id, type: TYPE, after: { ...r.content, order } });
88
+ });
89
+ return out;
90
+ }
91
+ var OPERATIONS = {
92
+ "log.add": (s, input, id, ctx) => {
93
+ onlyFields(input, "log.add", FIELDS);
94
+ const title = textInput(input, "title", ctx);
95
+ const decided = textInput(input, "decided", ctx);
96
+ if (!title) throw new Reject("INVALID_INPUT", "log.add needs title. Give a one-line name for the memo");
97
+ if (!decided) throw new Reject("INVALID_INPUT", "log.add needs decided. Give what was decided or what was done");
98
+ const content = { title, decided, why: textInput(input, "why", ctx), code: textInput(input, "code", ctx) };
99
+ const list = logsOf(s);
100
+ return { changes: placed(list, list.length, { id: id(0), type: TYPE, prefix: PREFIX, after: null }, content), summary: `Added memo (${id(0)}): ${title}` };
101
+ },
102
+ "log.update": (s, input, _id, ctx) => {
103
+ onlyFields(input, "log.update", ["log", ...FIELDS]);
104
+ const r = need(s, input.log);
105
+ const c = r.content;
106
+ const given = FIELDS.filter((f) => input[f] !== void 0);
107
+ if (!given.length) throw new Reject("INVALID_INPUT", "log.update has no field to change. Give only the fields to change from title, decided, why and code. To clear why or code, give null or empty text");
108
+ const next = { title: c.title, decided: c.decided, why: c.why, code: c.code };
109
+ for (const f of given) next[f] = textInput(input, f, ctx);
110
+ const after = contentOf({ title: next.title, decided: next.decided, why: next.why, code: next.code, order: c.order });
111
+ const changed = FIELDS.filter((f) => (c[f] ?? "") !== (after[f] ?? ""));
112
+ return {
113
+ changes: [{ id: r.id, type: TYPE, after }],
114
+ summary: changed.length ? `Edited memo ${r.id} (${changed.map((f) => FIELD_NAME[f]).join(", ")}): ${after.title}` : `Memo ${r.id} (${c.title}): nothing changed`
115
+ };
116
+ },
117
+ "log.move": (s, input) => {
118
+ onlyFields(input, "log.move", ["log", "after"]);
119
+ const r = need(s, input.log);
120
+ const all = logsOf(s);
121
+ const list = all.filter((x) => x.id !== r.id);
122
+ const a = input.after;
123
+ let index;
124
+ if (a === void 0) index = list.length;
125
+ else if (a === null) index = 0;
126
+ else {
127
+ if (typeof a !== "string" || a === "") throw new Reject("INVALID_INPUT", "after is the id of the memo that comes before. Give null for the top, or leave it out for the end");
128
+ if (a === r.id) throw new Reject("INVALID_INPUT", `after cannot be memo ${r.id}, the memo being moved. Give the id of another memo that comes before`);
129
+ need(s, a);
130
+ index = list.findIndex((x) => x.id === a) + 1;
131
+ }
132
+ const c = r.content;
133
+ const at = index === 0 ? "at the top" : index === list.length ? "at the end" : `after ${list[index - 1].id}`;
134
+ const where = index === 0 ? "to the top" : index === list.length ? "to the end" : `after ${list[index - 1].id}`;
135
+ if (all.indexOf(r) === index) return { changes: [], summary: `Memo ${r.id} (${c.title}) is already ${at}` };
136
+ const { order: _order, ...rest } = c;
137
+ const refs = index > 0 ? { after: list[index - 1].id } : void 0;
138
+ return {
139
+ changes: placed(list, index, { id: r.id, type: TYPE, after: null, moved: true, ...refs ? { refs } : {} }, rest),
140
+ summary: `Moved memo (${r.id} ${c.title}): ${where}`
141
+ };
142
+ },
143
+ "log.remove": (s, input) => {
144
+ onlyFields(input, "log.remove", ["log"]);
145
+ const r = need(s, input.log);
146
+ return { changes: [{ id: r.id, type: TYPE, after: null }], summary: `Removed memo (${r.id}): ${r.content.title}` };
147
+ }
148
+ };
149
+ function contentProblem(raw) {
150
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return "the content is not an object";
151
+ const c = raw;
152
+ const extra = Object.keys(c).filter((k) => !FIELDS.includes(k) && k !== "order");
153
+ if (extra.length) return `it has unknown fields: ${extra.join(", ")}`;
154
+ for (const f of FIELDS) {
155
+ const v = c[f];
156
+ if (v === void 0 && !REQUIRED.has(f)) continue;
157
+ if (typeof v !== "string" || v.trim() === "") return `${f} must be text that is not empty`;
158
+ if (chars(v) > LIMITS[f]) return `${f} is over the limit of ${LIMITS[f]} characters`;
159
+ if (f === "title" && /[\r\n]/.test(v)) return "title must be one line";
160
+ }
161
+ if (!Number.isSafeInteger(c.order)) return "order must be an integer";
162
+ return null;
163
+ }
164
+ function validate(candidate, changed) {
165
+ const out = [];
166
+ for (const id of changed) {
167
+ const r = candidate.records[id];
168
+ if (!r) continue;
169
+ if (r.type !== TYPE) {
170
+ out.push({ level: "error", code: "unknown_type", record: id, message: `${id} has the type ${r.type}, which this screen does not have. It has only process memos (log)` });
171
+ continue;
172
+ }
173
+ const problem = contentProblem(r.content);
174
+ if (problem) out.push({ level: "error", code: "bad_log", record: id, message: `Memo ${id}: ${problem}` });
175
+ }
176
+ return out;
177
+ }
178
+ function logScope(s, ids) {
179
+ if (ids === null) return null;
180
+ for (const id of ids) {
181
+ if (typeof id !== "string" || !s.records[id]) throw new Reject("TARGET_NOT_FOUND", `Memo ${String(id)} was not found`);
182
+ if (s.records[id].type !== TYPE) throw new Reject("INVALID_INPUT", `scope takes memo ids. ${id} is a ${s.records[id].type}`);
183
+ }
184
+ const want = new Set(ids);
185
+ return logsOf(s).filter((r) => want.has(r.id)).map((r) => r.id);
186
+ }
187
+ var scopeIds = (scope) => scope?.targets ?? (scope?.target !== void 0 ? [scope.target] : null);
188
+ var HEAD = 120;
189
+ function head(text) {
190
+ const one = text.replace(/\s+/g, " ").trim();
191
+ const cs = [...one];
192
+ return cs.length > HEAD ? `${cs.slice(0, HEAD).join("")}... (${chars(text)} characters in all)` : one;
193
+ }
194
+ var lineCount = (text) => text.split("\n").length;
195
+ var count = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
196
+ function fenced(code) {
197
+ const longest = Math.max(0, ...(code.match(/`+/g) ?? []).map((x) => x.length));
198
+ const fence = "`".repeat(Math.max(3, longest + 1));
199
+ return `${fence}
200
+ ${code}
201
+ ${fence}`;
202
+ }
203
+ function fullText(c) {
204
+ return [
205
+ `Title: ${c.title}`,
206
+ "Decision:",
207
+ c.decided,
208
+ ...c.why ? ["Reason:", c.why] : ["Reason: not written"],
209
+ ...c.code ? ["Code:", fenced(c.code)] : []
210
+ ];
211
+ }
212
+ function conceptText(s, ids, mine) {
213
+ const starred = new Set(mine.flatMap((m) => m.changes.filter((c) => c.after !== null).map((c) => c.record)));
214
+ const star = (id) => starred.has(id) ? " *" : "";
215
+ const list = logsOf(s);
216
+ if (!list.length) return "There are no process memos. Talk with the person and write what you agree to keep with log.add.";
217
+ const pos = new Map(list.map((r, i) => [r.id, i + 1]));
218
+ if (ids === null) {
219
+ const lines = [`${count(list.length, "process memo")}, in list order from the top. Only the start of each field is shown. To read one memo in full, give its memo id in scope.`];
220
+ for (const r of list) {
221
+ const c = r.content;
222
+ lines.push(`${pos.get(r.id)}. (${r.id})${star(r.id)} ${c.title}`, ` Decision: ${head(c.decided)}`);
223
+ if (c.why) lines.push(` Reason: ${head(c.why)}`);
224
+ if (c.code) lines.push(` Code, ${count(lineCount(c.code), "line")}: ${head(c.code)}`);
225
+ }
226
+ return lines.join("\n");
227
+ }
228
+ const blocks = ids.map((id) => [`Memo (${id})${star(id)}, number ${pos.get(id)} in the list`, ...fullText(log(s, id))].join("\n"));
229
+ return [`Read ${ids.length} of ${count(list.length, "process memo")} in full`, ...blocks].join("\n\n");
230
+ }
231
+ function project(s, scope, mine) {
232
+ const ids = logScope(s, scopeIds(scope));
233
+ return {
234
+ text: conceptText(s, ids, mine),
235
+ scopeLabel: ids ? `Read memos ${ids.join(", ")} in full` : "Read everything",
236
+ // 화면은 한 번에 받아 목록을 그린다. 좁혀 읽어도 JSON 은 전체다
237
+ json: {
238
+ logs: logsOf(s).map((r) => {
239
+ const c = r.content;
240
+ return { id: r.id, title: c.title, decided: c.decided, why: c.why ?? null, code: c.code ?? null, order: c.order };
241
+ })
242
+ },
243
+ ...ids ? { records: ids } : {}
244
+ };
245
+ }
246
+ var WRITE_RULES = [
247
+ "Rules for writing the write-up",
248
+ "- Write it in the language the person uses with you, the same language the memos are written in. These rules are in English, but that does not mean the write-up should be in English.",
249
+ "- Write one section for each memo. In each section, write what was decided, why it was decided that way, and what to do next, in that order. If there is nothing to do next, leave that out.",
250
+ "- Do not copy the conversation. Write what you understood, so that someone who reads only this write-up later knows what was decided and why.",
251
+ "- Do not make up anything that is not in the memos. If a memo is missing something, ask the person and fix the memo first.",
252
+ "- The section name is the memo title. The receiving side may add the section name as a heading, so do not repeat the title inside the text.",
253
+ "- Put code in a code block, and only the code from the memo that will be needed next.",
254
+ "- Do not put secrets (keys, tokens, passwords) in the write-up, even if a memo has them."
255
+ ].join("\n");
256
+ function prepareGeneration(s, scope, medium) {
257
+ if (medium !== "text") throw new Reject("UNSUPPORTED_CAPABILITY", `This plugin cannot make the medium ${medium}. It makes only text`);
258
+ const ids = logScope(s, Array.isArray(scope?.targets) ? scope.targets : null) ?? logsOf(s).map((r) => r.id);
259
+ if (!ids.length) throw new Reject("INVALID_STATE", "There are no process memos to keep. Talk with the person and write what you agree on with log.add first");
260
+ const memos = ids.map((id) => [`Memo (${id})`, ...fullText(log(s, id))].join("\n"));
261
+ return {
262
+ material: [`Write a write-up from ${count(ids.length, "process memo")}.`, "", WRITE_RULES, "", ...memos.flatMap((m) => [m, ""])].join("\n").trimEnd(),
263
+ sections: ids.map((id) => {
264
+ const c = log(s, id);
265
+ return { key: id, label: c.title, content: fullText(c).join("\n") };
266
+ }),
267
+ records: ids
268
+ };
269
+ }
270
+ var SELECTION_FORMAT = "aic.process-log/selection-1";
271
+ var MAX_SELECTED = 200;
272
+ function selectionProblem(v) {
273
+ const x = v;
274
+ if (typeof x !== "object" || x === null || x.format !== SELECTION_FORMAT) return `The format of the selection is not ${SELECTION_FORMAT}`;
275
+ if (typeof x.rev !== "string") return "The selection has no revision it was drawn from (rev)";
276
+ if (!Array.isArray(x.logs) || !x.logs.every((id) => typeof id === "string")) return "logs of the selection must be a list of memo ids";
277
+ if (x.logs.length > MAX_SELECTED) return `The selection has too many memos (${x.logs.length}, up to ${MAX_SELECTED})`;
278
+ if (x.labels !== void 0 && (typeof x.labels !== "object" || x.labels === null || Array.isArray(x.labels))) return "labels of the selection must be an object from memo id to title";
279
+ return null;
280
+ }
281
+ function describeSelection(s, input) {
282
+ const problem = selectionProblem(input?.selection);
283
+ if (problem) throw new Reject("INVALID_INPUT", problem);
284
+ const sel = input.selection;
285
+ const list = logsOf(s);
286
+ const pos = new Map(list.map((r, i) => [r.id, i + 1]));
287
+ const targets = [];
288
+ const gone = [];
289
+ const now = typeof input.current === "string" && input.current !== sel.rev ? ` Something changed after that (now ${input.current}). What follows is the current state.` : "";
290
+ const lines = [`Revision when selected: ${sel.rev}.${now}`];
291
+ if (!sel.logs.length) lines.push(`No memo is selected. The words are about the whole process log (${count(list.length, "process memo")}).`);
292
+ else lines.push(`Selected memos (${sel.logs.length}):`);
293
+ for (const id of sel.logs) {
294
+ const r = s.records[id];
295
+ if (r?.type !== TYPE) {
296
+ gone.push(id);
297
+ lines.push(`- (${id}) ${sel.labels?.[id] ?? "title unknown"} (removed since)`);
298
+ continue;
299
+ }
300
+ targets.push(id);
301
+ const c = r.content;
302
+ lines.push(`- (${id}) number ${pos.get(id)} in the list: ${c.title}`, ` Decision: ${head(c.decided)}`);
303
+ if (c.why) lines.push(` Reason: ${head(c.why)}`);
304
+ if (c.code) lines.push(` Code, ${count(lineCount(c.code), "line")}: ${head(c.code)}`);
305
+ }
306
+ if (targets.length) lines.push("To read a memo in full, give its memo id in the scope of read_concept.");
307
+ return { text: lines.join("\n"), targets, gone };
308
+ }
309
+ var AI_GUIDE = [
310
+ "This screen is for writing down, as process memos, what the person and you decided while working and why, and for turning several memos into one write-up as an output. The write-up is saved to AiAkiv through the AiAkiv external connection.",
311
+ "Decide with the person what to keep. Do not decide on your own what to write or save.",
312
+ "Write one decision per memo. title is a one-line name, decided is what was decided or done, why is the reason for it, and code is code or commands to keep with it. Do not copy the conversation. Write what you understood.",
313
+ "Like ak save, a write-up says what, why and what to do next, and does not copy the conversation. Write the memos and the write-up in the language the person uses with you, even though this guide is in English.",
314
+ "Do not put secrets (keys, tokens, passwords) in memos or in the write-up.",
315
+ "The steps to keep a record are: 1) Switch to this instance with propose_switch, then write memos with log.add. If the core waits for the person to agree to the switch, write after the person agrees. The person also writes and edits memos on the screen.",
316
+ "2) Put all the memo ids to keep this time in the scope of begin_generation as one list, and make the write-up in one go. One output is one save in AiAkiv, so splitting it uses more of the daily save limit. Read the material, write one section per memo, and pass them to finish_generation.",
317
+ "3) Switch to the AiAkiv external connection instance with propose_switch. If the work has no AiAkiv external connection instance, ask the person, then add one with add_instance, giving in connection the AiAkiv connection name listed in connections of describe_document. If there is no connection, tell the person that they need to make a connection on this computer, and stop after making the write-up. 4) Read the cost and the description number with read_link. If the cost is paid or unknown, ask the person whether this may be saved to AiAkiv, then send the description number with it. The person chooses the save project on the external connection screen. If they do not choose one, it is Main. Do not put project in options.",
318
+ "5) If it is the first record of the work, send it with send_artifact. If a representation was already sent, call update_representation with dry_run first, then give the keys (memo ids) of new and edited memos in apply. An update is also a new record in AiAkiv and uses the daily save limit. 6) Go back to the instance you were working in.",
319
+ "Without the AiAkiv external connection, you can still write memos and make the write-up. This screen does not know which memos were sent. Read what was sent with read_link and the dry_run of update_representation.",
320
+ "A full read shows only the start of each field. To read one memo in full, give its memo id in the scope of read_concept.",
321
+ "When the person selects memos on the screen and sends them with words, read them with read_selection. The words are about those memos, for example what to fix in them."
322
+ ].join(" ");
323
+ var DESCRIPTION = {
324
+ id: PACKAGE_ID,
325
+ version: VERSION,
326
+ title: "Process Log",
327
+ aiGuide: AI_GUIDE,
328
+ markGuide: 'Memo fields are plain text. Do not use marks inside the text. For a memo made in the same request, give a $name with "as" and point to it from log in other operations.',
329
+ operations: [
330
+ {
331
+ op: "log.add",
332
+ input: {
333
+ title: "A one-line name for the memo. Up to 200 characters. It becomes the section name in the write-up",
334
+ decided: "What was decided or done. Up to 4000 characters",
335
+ why: "The reason for the decision. Up to 4000 characters. Leave it out if there is none",
336
+ code: "Code or commands to keep with it. Up to 20000 characters. Leave it out if there is none"
337
+ },
338
+ summary: "Adds a process memo at the end of the list",
339
+ example: [
340
+ {
341
+ op: "log.add",
342
+ as: "$storage",
343
+ input: { title: "Store in one SQLite file", decided: "Work data goes in one SQLite file in the data folder.", why: "With no server to install, it starts right away on a personal computer." }
344
+ },
345
+ { op: "log.add", input: { title: "Backup command", decided: "Back up by copying the file.", code: "cp data/aic.sqlite backup/aic.sqlite" } }
346
+ ]
347
+ },
348
+ {
349
+ op: "log.update",
350
+ input: {
351
+ log: "Memo id",
352
+ title: "New title. Leave it out to keep it",
353
+ decided: "New decision. Leave it out to keep it",
354
+ why: "New reason. Leave it out to keep it. null or empty text clears it",
355
+ code: "New code. Leave it out to keep it. null or empty text clears it"
356
+ },
357
+ summary: "Changes only the fields given. The id and the order stay the same",
358
+ example: [{ op: "log.update", input: { log: "lg1", why: "There is no server to install, and one file is easy to move." } }]
359
+ },
360
+ {
361
+ op: "log.move",
362
+ input: { log: "Memo id", after: "The id of the memo that comes before. null for the top. Leave it out for the end" },
363
+ summary: "Changes the place of a memo in the list. The id stays the same",
364
+ example: [{ op: "log.move", input: { log: "lg2", after: null } }]
365
+ },
366
+ { op: "log.remove", input: { log: "Memo id" }, summary: "Removes a memo. A record already sent outside is not removed. Ask the person first" }
367
+ ]
368
+ };
369
+ var run = (f) => {
370
+ try {
371
+ return f();
372
+ } catch (e) {
373
+ if (e instanceof Reject) return { error: e.code, summary: e.message };
374
+ throw e;
375
+ }
376
+ };
377
+ var logic = {
378
+ describe: () => DESCRIPTION,
379
+ initialize: () => [],
380
+ plan(state, op, ctx) {
381
+ const handler = OPERATIONS[op.op];
382
+ if (!handler) return { error: "INVALID_INPUT", summary: `Unknown operation ${op.op}. The operations are log.add, log.update, log.move and log.remove` };
383
+ const id = (k) => k === 0 && op.as ? op.as : `$~${ctx.stepIndex}.${k}`;
384
+ return run(() => {
385
+ const out = handler(state, inputObject(op.input ?? {}), id, ctx);
386
+ return { ...out, summary: /[.?!]$/.test(out.summary) ? out.summary : `${out.summary}.` };
387
+ });
388
+ },
389
+ validate,
390
+ project: (state, scope, mine) => run(() => project(state, scope, mine)),
391
+ extractRefs: () => [],
392
+ prepareGeneration: (state, scope, medium) => run(() => prepareGeneration(state, scope, medium)),
393
+ /** 결과물 글에서 고른 구간의 메모가 후보다(3.3절). targets 는 고른 곳에 걸친 구간의 열쇠 가운데 지금 있는 것이다. */
394
+ interpretSelection(state, sel) {
395
+ const want = new Set(Array.isArray(sel?.targets) ? sel.targets : []);
396
+ const candidates = logsOf(state).filter((r) => want.has(r.id)).map((r) => ({ id: r.id, label: `Memo ${r.id}: ${r.content.title}`, why: "The selected text is in this memo's section" }));
397
+ return { candidates };
398
+ },
399
+ resolveTarget(state, target) {
400
+ const r = state.records[target.id];
401
+ return r && r.type === TYPE ? { found: true, label: `Memo ${r.id}: ${r.content.title}` } : { found: false };
402
+ },
403
+ describeSelection: (state, input) => run(() => describeSelection(state, input))
404
+ };
405
+ globalThis.__aicPlugin = logic;
406
+ })();
@@ -0,0 +1,131 @@
1
+ # Process Log Manual
2
+
3
+ This is the detailed manual for both people and AI. People open it with [설명서] (Manual) in the plugin window of the AIC screen. The AI reads it with `read_plugin_manual`.
4
+
5
+ ## What this screen does
6
+
7
+ Process Log (`aic.process-log`) is a screen for writing down, as process memos, what you and the AI decided while working and why. Use it in long jobs when you want to look up later what was decided and why.
8
+
9
+ You can stop after writing memos. Or the AI can turn the memos you chose to keep into a write-up and make it an output. If an AiAkiv external connection is set up, the write-up is saved to AiAkiv after you confirm it. This plugin knows nothing about the network or AiAkiv. Sending to AiAkiv is done by the external connection in the AIC core.
10
+
11
+ The write-up is written in the language you use with the AI, the same language as the memos. The guide text the AI reads is in English, but that does not change the language of your memos or write-ups.
12
+
13
+ The buttons and guidance on the screen follow the language you chose for the AIC screen. If you chose Korean, they are in Korean. Otherwise they are in English. The feature names in this manual are the English ones. Messages from the plugin logic, such as the reason an edit was rejected, stay in English.
14
+
15
+ ## Memo fields
16
+
17
+ Write one decision per memo.
18
+
19
+ | Field | Name in operations | Limit | Meaning |
20
+ | --- | --- | --- | --- |
21
+ | Title | `title` | 200 characters, one line, required | The name of the memo. It becomes the section name in the write-up |
22
+ | Decision | `decided` | 4,000 characters, required | What was decided or done |
23
+ | Reason | `why` | 4,000 characters, optional | Why it was decided that way |
24
+ | Code or commands | `code` | 20,000 characters, optional | Code or commands to keep with it |
25
+
26
+ - Memo ids look like `lg1` and `lg2`, and they do not change. If you edit the title or change the order, it is still the same memo. On the screen, hover over the number in front of a memo to see its id.
27
+ - Do not write secrets such as keys, tokens or passwords in memos. A memo can become part of a write-up and be saved in AiAkiv.
28
+ - Do not copy the conversation as it is. Write what was decided and why, in your own understanding.
29
+
30
+ ## Screen features
31
+
32
+ | Feature | What you do | What the AI does |
33
+ | --- | --- | --- |
34
+ | Add a memo | Click [+ Memo], write a title and a decision, then click [Add] | Adds it with `log.add`. Several memos go in one request |
35
+ | Edit a memo | Click the pencil (✎) button on the memo, edit the fields, then click [Save] | Gives `log.update` the memo id and only the fields to change |
36
+ | Clear a reason or code | Click the pencil button, empty that field, then save | Gives that field to `log.update` as `null` or empty text |
37
+ | Change the order | Click ↑ or ↓ on the memo | Gives `log.move` the id of the memo that comes before in `after`. `null` means the top. Leaving it out means the end |
38
+ | Remove a memo | Click ×, then click it once more to confirm | Asks you first, then removes it with `log.remove` |
39
+ | See long code | If code is longer than 6 lines, only the start is shown. Open it with [Show all N lines of code] and close it with [Fold code] | Reads the whole memo by giving its memo id in the `scope` of `read_concept` |
40
+ | Tell the AI about memos | Click a memo to select it. Ctrl+click (Cmd+click on Mac) adds or removes a memo, and clicking the only selected memo again clears it, as does Esc. As soon as a memo is selected, a small box appears at the top of the screen, and the memos move down so it does not cover them. Write what you want to say and press Enter or click [Send] | Reads the memos you selected and your words with `read_selection`. Even if you only select memos without sending, the AI can read what you selected |
41
+ | See what the AI changed | Memos the AI changed that are not final yet get a "New", "Edited" or "Moved" mark. Click "Edited" to see the text before the change. Hover over a mark to see what it means | When you do your next operation, everything you see now becomes final |
42
+ | When you both edited the same memo | Both versions appear side by side below the memo. Choose [Keep mine] or the other side's version | Waits until you choose, or talks with you and then edits |
43
+ | Make a write-up | Tell the AI which memos to keep | Makes the output with `begin_generation` and `finish_generation` |
44
+ | Match the write-up to memos | Click a section in the output text, and the memo for that section is highlighted | Reads the section and memo you pointed to with `read_selection` |
45
+
46
+ The box at the top appears only while memos are selected, and not while you are writing or editing a memo. On a screen you can only read, you cannot select memos. The ↑, ↓, pencil and × buttons on a memo appear when you hover over the memo. In the edit fields, press Enter in the title field or Ctrl+Enter (Cmd+Enter on Mac) in the other fields to save, and Esc to cancel. This tip also appears when you hover over [Save]. Each field shows its character count and limit. If a field is over its limit, it is not saved.
47
+
48
+ ## How you work together
49
+
50
+ 1. You ask the AI to use Process Log. For a new work, the AI gives `aic.process-log` to `create_document`. For an existing work, it gives it to `add_instance`.
51
+ 2. When a decision worth keeping comes up, the AI switches to this instance (`propose_switch`). While you are not editing the screen, it switches right away without asking you, and the status row at the top of the screen shows that the AI switched to this screen and why. While you are editing after [가져오기] (Take over), the AI cannot switch. On a core with the cursor turned off, the AI switches only after you agree, as before.
52
+ 3. You and the AI decide together what to keep. The AI does not decide on its own what to write or save. The AI copies what you said into `human_words` and writes the memo with your words as the cause.
53
+ 4. You edit memos and change their order directly on the screen. The AI sees your edits the next time it reads.
54
+ 5. To go back to the earlier task, the AI switches back to the instance it was working in. It switches the same way as in step 2.
55
+
56
+ ## Making a write-up
57
+
58
+ A write-up, like a record in AiAkiv, says what was decided, why, and what to do next.
59
+
60
+ 1. Decide with the AI which memos to keep this time.
61
+ 2. The AI puts all those memo ids in the `scope` of `begin_generation` and makes the write-up in one go. The material includes the writing rules and the full memos.
62
+ 3. The AI writes one section per memo and passes them to `finish_generation`. The key of each section is the memo id, and the section name is the memo title.
63
+
64
+ If you plan to send it to AiAkiv, gather all the memos to keep into one output. Sending one output is one save in AiAkiv, so splitting it uses more of the daily save limit.
65
+
66
+ ## Saving to AiAkiv
67
+
68
+ To save to AiAkiv, you first need to make an AiAkiv connection in the connection file on this computer. Only you can make a connection. The AI cannot. Without a connection, you can still write memos and make write-ups.
69
+
70
+ ### The first save
71
+
72
+ 1. If the work has no AiAkiv external connection instance, the AI asks you, then adds one by giving the connection name in the `connection` of `add_instance`.
73
+ 2. The AI switches to the AiAkiv external connection instance. It switches the same way as in step 2 of "How you work together".
74
+ 3. The AI reads the cost and the description number with `read_link`. AiAkiv states its cost as "unknown", so each time, the AI asks you whether it may save, and sends that description number with it. If it sends without your confirmation, the core blocks it with `cost_unconfirmed` and sends nothing.
75
+ 4. The AI sends the write-up output with `send_artifact`. One record is made in AiAkiv, and it uses one of your daily saves.
76
+ 5. The AI goes back to the instance it was working in.
77
+
78
+ ### Choosing the save project
79
+
80
+ Only you choose the AiAkiv project where records are saved. This stops hidden instructions in other text from making the AI change where things are saved.
81
+
82
+ - Choose the project from the list box in "사람이 고르는 설정" (settings the person chooses) on the AiAkiv external connection screen. The list shows only the projects that account can save to.
83
+ - If you leave it at "고르지 않음" (not chosen), the field is not sent, and records are saved to the Main project of the AiAkiv account.
84
+ - The AI only reads your choice with `read_link`. If the AI puts `project` in `options` when sending, the core rejects it with `person_option`. When sending, the core puts in the value you chose.
85
+ - If the chosen project has dropped off the list in the meantime, the core rejects it with `person_option_stale`. Choose again.
86
+ - If the project is set in the connection address, or you connected with a key tied to a project, this field does not appear. Records are saved only to that project.
87
+ - A project change applies from the next new record you send. When you update a record that was already sent, the update is added after it in the project of the first record.
88
+
89
+ ### Saving again after adding or editing memos
90
+
91
+ AiAkiv does not edit the body of a saved record. So when you update a write-up that was already sent, a new record is added after the earlier one, and the earlier one stays as history.
92
+
93
+ 1. After writing new memos or editing memos, make the write-up again with all the memos to keep.
94
+ 2. Switch to the AiAkiv external connection instance and call `update_representation` with `dry_run` first. Each memo comes back as same, changed or new, along with an `expectedVersion`.
95
+ 3. After you confirm what to save again, the AI updates it by giving the keys (memo ids) of new and edited memos in `apply` and passing the same `expectedVersion`. Each update with a non-empty `apply` is one new record and uses one of your daily saves.
96
+ 4. Removing a memo does not remove the record in AiAkiv. Process logs are not removed, as a rule. If you want to remove one, hide that record in AiAkiv yourself.
97
+
98
+ ### Knowing what changed in AiAkiv
99
+
100
+ - When the AI observes with `observe_representation`, it gets a report of "removed" if a record was hidden in AiAkiv, and "new" if someone added a record after it.
101
+ - A report is not an instruction. You and the AI decide together whether to edit memos.
102
+ - If AiAkiv changed in the meantime when you try to update, a `conflict` comes back and nothing changes. The AI reads the report with `read_reports`, decides with you, and starts again from `dry_run`.
103
+ - This screen does not know which memos were saved to AiAkiv. See saved records on the AiAkiv external connection screen.
104
+
105
+ ## What AiAkiv tells you
106
+
107
+ AiAkiv tells you things only with short English messages that were registered and checked in advance.
108
+
109
+ | Case | Notice | What to do |
110
+ | --- | --- | --- |
111
+ | The daily save limit is reached | "Daily save limit reached" and the day it opens again | Only write memos that day, and save after the limit opens again |
112
+ | Few saves are left | The save went through, and the number left comes with it | Gather more memos and send them in one go |
113
+ | That memory takes no new saves because of the plan, or the memory is full | A notice that payment is needed | The AI says only the fact and the reason. You check it on the AiAkiv external connection screen |
114
+ | The write-up is too long | A notice that the body limit was exceeded | Split the memos or shorten the code fields, then make it again |
115
+ | The chosen project cannot be saved to | A notice that the project cannot be used | Choose the project again |
116
+
117
+ ## Common problems
118
+
119
+ - **Rejected with "cost_unconfirmed".** The AiAkiv cost is "unknown", so your confirmation is needed. The AI confirms the description number from `read_link` with you and sends that number with it. If the connection definition or description changed, read it again with `read_link(refresh: true)`.
120
+ - **Rejected with "person_option".** The AI put `project` in `options`. Leave it out and send again. You choose the project on the external connection screen.
121
+ - **Rejected with "paid_call_limit".** AIC sends paid or unknown-cost sends and updates only up to a set number per connection per hour. The AI tells you, and you wait.
122
+ - **The record was split into several.** A write-up was made and sent for each memo separately. Put all the memos to keep in the `scope` of `begin_generation` and make one output.
123
+ - **An edited memo was not reflected in AiAkiv.** The id of the edited memo was not in the `apply` of `update_representation`. Put in the keys that came back as "changed" in the `dry_run` result.
124
+ - **A full read does not show the whole memo.** A full read shows only the start of each field. Give the memo id in the `scope` of `read_concept` to see all of it.
125
+ - **An operation is rejected for unknown fields.** A memo has four fields: `title`, `decided`, `why` and `code`. If you give another field, it is rejected with a list of the fields you can use.
126
+ - **The title is rejected.** The title must be one line. Put the details in `decided`.
127
+ - **You need to point to a memo made in the same request.** Give a `$name` with `as` in `log.add`, and use that name in `log` or `after` of other operations in the same request.
128
+
129
+ ## Samples
130
+
131
+ The samples listed in `samples` of the manifest are records of real work done on this screen. You can read, in order, what the person said, what operations the AI did and how the screen changed.