@tomradex/takeover 0.0.0-stage → 0.27.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.
- package/LICENSE +204 -0
- package/dist/draft.d.ts +63 -0
- package/dist/facts.d.ts +75 -0
- package/dist/index.d.ts +4 -0
- package/dist/runtime.js +1 -0
- package/dist/service.d.ts +86 -0
- package/dist/words.d.ts +31 -0
- package/package.json +46 -4
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
Copyright 2026 Haoyuan Tang
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
Apache License
|
|
5
|
+
Version 2.0, January 2004
|
|
6
|
+
http://www.apache.org/licenses/
|
|
7
|
+
|
|
8
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
9
|
+
|
|
10
|
+
1. Definitions.
|
|
11
|
+
|
|
12
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
13
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
14
|
+
|
|
15
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
16
|
+
the copyright owner that is granting the License.
|
|
17
|
+
|
|
18
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
19
|
+
other entities that control, are controlled by, or are under common
|
|
20
|
+
control with that entity. For the purposes of this definition,
|
|
21
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
22
|
+
direction or management of such entity, whether by contract or
|
|
23
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
24
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
25
|
+
|
|
26
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
27
|
+
exercising permissions granted by this License.
|
|
28
|
+
|
|
29
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
30
|
+
including but not limited to software source code, documentation
|
|
31
|
+
source, and configuration files.
|
|
32
|
+
|
|
33
|
+
"Object" form shall mean any form resulting from mechanical
|
|
34
|
+
transformation or translation of a Source form, including but
|
|
35
|
+
not limited to compiled object code, generated documentation,
|
|
36
|
+
and conversions to other media types.
|
|
37
|
+
|
|
38
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
39
|
+
Object form, made available under the License, as indicated by a
|
|
40
|
+
copyright notice that is included in or attached to the work
|
|
41
|
+
(an example is provided in the Appendix below).
|
|
42
|
+
|
|
43
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
44
|
+
form, that is based on (or derived from) the Work and for which the
|
|
45
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
46
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
47
|
+
of this License, Derivative Works shall not include works that remain
|
|
48
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
49
|
+
the Work and Derivative Works thereof.
|
|
50
|
+
|
|
51
|
+
"Contribution" shall mean any work of authorship, including
|
|
52
|
+
the original version of the Work and any modifications or additions
|
|
53
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
54
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
55
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
56
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
57
|
+
means any form of electronic, verbal, or written communication sent
|
|
58
|
+
to the Licensor or its representatives, including but not limited to
|
|
59
|
+
communication on electronic mailing lists, source code control systems,
|
|
60
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
61
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
62
|
+
excluding communication that is conspicuously marked or otherwise
|
|
63
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
64
|
+
|
|
65
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
66
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
67
|
+
subsequently incorporated within the Work.
|
|
68
|
+
|
|
69
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
70
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
71
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
72
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
73
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
74
|
+
Work and such Derivative Works in Source or Object form.
|
|
75
|
+
|
|
76
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
77
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
78
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
79
|
+
(except as stated in this section) patent license to make, have made,
|
|
80
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
81
|
+
where such license applies only to those patent claims licensable
|
|
82
|
+
by such Contributor that are necessarily infringed by their
|
|
83
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
84
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
85
|
+
institute patent litigation against any entity (including a
|
|
86
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
87
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
88
|
+
or contributory patent infringement, then any patent licenses
|
|
89
|
+
granted to You under this License for that Work shall terminate
|
|
90
|
+
as of the date such litigation is filed.
|
|
91
|
+
|
|
92
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
93
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
94
|
+
modifications, and in Source or Object form, provided that You
|
|
95
|
+
meet the following conditions:
|
|
96
|
+
|
|
97
|
+
(a) You must give any other recipients of the Work or
|
|
98
|
+
Derivative Works a copy of this License; and
|
|
99
|
+
|
|
100
|
+
(b) You must cause any modified files to carry prominent notices
|
|
101
|
+
stating that You changed the files; and
|
|
102
|
+
|
|
103
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
104
|
+
that You distribute, all copyright, patent, trademark, and
|
|
105
|
+
attribution notices from the Source form of the Work,
|
|
106
|
+
excluding those notices that do not pertain to any part of
|
|
107
|
+
the Derivative Works; and
|
|
108
|
+
|
|
109
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
110
|
+
distribution, then any Derivative Works that You distribute must
|
|
111
|
+
include a readable copy of the attribution notices contained
|
|
112
|
+
within such NOTICE file, excluding those notices that do not
|
|
113
|
+
pertain to any part of the Derivative Works, in at least one
|
|
114
|
+
of the following places: within a NOTICE text file distributed
|
|
115
|
+
as part of the Derivative Works; within the Source form or
|
|
116
|
+
documentation, if provided along with the Derivative Works; or,
|
|
117
|
+
within a display generated by the Derivative Works, if and
|
|
118
|
+
wherever such third-party notices normally appear. The contents
|
|
119
|
+
of the NOTICE file are for informational purposes only and
|
|
120
|
+
do not modify the License. You may add Your own attribution
|
|
121
|
+
notices within Derivative Works that You distribute, alongside
|
|
122
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
123
|
+
that such additional attribution notices cannot be construed
|
|
124
|
+
as modifying the License.
|
|
125
|
+
|
|
126
|
+
You may add Your own copyright statement to Your modifications and
|
|
127
|
+
may provide additional or different license terms and conditions
|
|
128
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
129
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
130
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
131
|
+
the conditions stated in this License.
|
|
132
|
+
|
|
133
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
134
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
135
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
136
|
+
this License, without any additional terms or conditions.
|
|
137
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
138
|
+
the terms of any separate license agreement you may have executed
|
|
139
|
+
with Licensor regarding such Contributions.
|
|
140
|
+
|
|
141
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
142
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
143
|
+
except as required for reasonable and customary use in describing the
|
|
144
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
145
|
+
|
|
146
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
147
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
148
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
149
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
150
|
+
implied, including, without limitation, any warranties or conditions
|
|
151
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
152
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
153
|
+
appropriateness of using or redistributing the Work and assume any
|
|
154
|
+
risks associated with Your exercise of permissions under this License.
|
|
155
|
+
|
|
156
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
157
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
158
|
+
unless required by applicable law (such as deliberate and grossly
|
|
159
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
160
|
+
liable to You for damages, including any direct, indirect, special,
|
|
161
|
+
incidental, or consequential damages of any character arising as a
|
|
162
|
+
result of this License or out of the use or inability to use the
|
|
163
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
164
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
165
|
+
other commercial damages or losses), even if such Contributor
|
|
166
|
+
has been advised of the possibility of such damages.
|
|
167
|
+
|
|
168
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
169
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
170
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
171
|
+
or other liability obligations and/or rights consistent with this
|
|
172
|
+
License. However, in accepting such obligations, You may act only
|
|
173
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
174
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
175
|
+
defend, and hold each Contributor harmless for any liability
|
|
176
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
177
|
+
of your accepting any such warranty or additional liability.
|
|
178
|
+
|
|
179
|
+
END OF TERMS AND CONDITIONS
|
|
180
|
+
|
|
181
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
182
|
+
|
|
183
|
+
To apply the Apache License to your work, attach the following
|
|
184
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
185
|
+
replaced with your own identifying information. (Don't include
|
|
186
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
187
|
+
comment syntax for the file format. We also recommend that a
|
|
188
|
+
file or class name and description of purpose be included on the
|
|
189
|
+
same "printed page" as the copyright notice for easier
|
|
190
|
+
identification within third-party archives.
|
|
191
|
+
|
|
192
|
+
Copyright [yyyy] [name of copyright owner]
|
|
193
|
+
|
|
194
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
195
|
+
you may not use this file except in compliance with the License.
|
|
196
|
+
You may obtain a copy of the License at
|
|
197
|
+
|
|
198
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
199
|
+
|
|
200
|
+
Unless required by applicable law or agreed to in writing, software
|
|
201
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
202
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
203
|
+
See the License for the specific language governing permissions and
|
|
204
|
+
limitations under the License.
|
package/dist/draft.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type Item, type LanguageTag } from "@tomradex/domain";
|
|
2
|
+
import type { LlmService } from "@tomradex/llm";
|
|
3
|
+
import type { BranchFact, IssueFact, SessionFact, WorktreeFact } from "./facts.js";
|
|
4
|
+
import type { TakeoverWords } from "./words.js";
|
|
5
|
+
export type TakeoverSourceKind = "branch" | "worktree" | "issue" | "session";
|
|
6
|
+
/** One thing the scan saw, enough to find it again. */
|
|
7
|
+
export interface TakeoverSource {
|
|
8
|
+
kind: TakeoverSourceKind;
|
|
9
|
+
/** Says what kind it is: "Branch", "Claude Code session". */
|
|
10
|
+
label: string;
|
|
11
|
+
repoName: string;
|
|
12
|
+
/** The branch, the folder, owner/repo#n, or the record's file. */
|
|
13
|
+
ref: string;
|
|
14
|
+
url: string | null;
|
|
15
|
+
detail: string;
|
|
16
|
+
}
|
|
17
|
+
export interface TakeoverEntry {
|
|
18
|
+
id: string;
|
|
19
|
+
title: string;
|
|
20
|
+
summary: string;
|
|
21
|
+
sources: TakeoverSource[];
|
|
22
|
+
/** Entries this one needs first. */
|
|
23
|
+
dependsOn: string[];
|
|
24
|
+
/** A ticket that may already hold this. */
|
|
25
|
+
similar: {
|
|
26
|
+
key: string;
|
|
27
|
+
title: string;
|
|
28
|
+
verdict: "duplicate" | "related";
|
|
29
|
+
} | null;
|
|
30
|
+
/** The backlog seems to hold this already, by a model's reading, though no one ticket matches. */
|
|
31
|
+
covered: boolean;
|
|
32
|
+
/** Set where ticking it should link a branch. */
|
|
33
|
+
repoId: string | null;
|
|
34
|
+
branch: string | null;
|
|
35
|
+
}
|
|
36
|
+
export interface Facts {
|
|
37
|
+
branches: BranchFact[];
|
|
38
|
+
worktrees: WorktreeFact[];
|
|
39
|
+
issues: IssueFact[];
|
|
40
|
+
sessions: SessionFact[];
|
|
41
|
+
}
|
|
42
|
+
/** The issue numbers a branch's name or commits point at. */
|
|
43
|
+
export declare function issueNumbers(branch: BranchFact): Set<number>;
|
|
44
|
+
/**
|
|
45
|
+
* The scan's facts as draft entries, one per piece of work: a branch collects
|
|
46
|
+
* the worktree it is checked out in, the issue it closes and the sessions that
|
|
47
|
+
* worked on it, so one piece of work is never ticked twice.
|
|
48
|
+
*/
|
|
49
|
+
export declare function buildEntries(facts: Facts, w: TakeoverWords): TakeoverEntry[];
|
|
50
|
+
/** Everything `organize` sends: named here so what a person agrees to and what goes out are the same list. */
|
|
51
|
+
export declare function entryForModel(entry: TakeoverEntry, label: string, facts: Facts): string;
|
|
52
|
+
/** One worker call: better titles, what is left, sessions that finished, and dependencies git cannot see. Returns how many sessions it dropped. */
|
|
53
|
+
export declare function organize(llm: LlmService, entries: TakeoverEntry[], facts: Facts, locale: LanguageTag): Promise<{
|
|
54
|
+
entries: TakeoverEntry[];
|
|
55
|
+
dropped: number;
|
|
56
|
+
}>;
|
|
57
|
+
/** `find_similar` over the draft. Without leave for a model, `llm` is null and it stays on this machine. */
|
|
58
|
+
export declare function markSimilar(llm: LlmService | null, entries: TakeoverEntry[], existing: Item[]): Promise<void>;
|
|
59
|
+
/** `find_gaps` over the draft: what it does not call missing, the backlog seems to hold already. */
|
|
60
|
+
export declare function markCovered(llm: LlmService, entries: TakeoverEntry[], existing: Item[], brief: string | null): Promise<void>;
|
|
61
|
+
/** A ticket's body: what is known, then every source, so the ticket can be traced back. */
|
|
62
|
+
export declare function ticketBody(entry: TakeoverEntry, w: TakeoverWords): string;
|
|
63
|
+
//# sourceMappingURL=draft.d.ts.map
|
package/dist/facts.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { EngineRecord, RecordSession } from "@tomradex/agent";
|
|
2
|
+
import type { UnmergedBranch } from "@tomradex/code-link";
|
|
3
|
+
import type { Git } from "@tomradex/git";
|
|
4
|
+
/** Most branches a draft lists: past this it stops being something a person ticks through. */
|
|
5
|
+
export declare const MAX_BRANCHES = 100;
|
|
6
|
+
/** A worktree touched more recently than this may still be in use. */
|
|
7
|
+
export declare const IDLE_MS: number;
|
|
8
|
+
export interface BranchFact extends UnmergedBranch {
|
|
9
|
+
/** The default branch as this repository calls it. */
|
|
10
|
+
base: string;
|
|
11
|
+
/** Newest first. */
|
|
12
|
+
subjects: string[];
|
|
13
|
+
/** The closest other unmerged branch this one was built on. */
|
|
14
|
+
parent: string | null;
|
|
15
|
+
}
|
|
16
|
+
export interface WorktreeFact {
|
|
17
|
+
repoId: string;
|
|
18
|
+
repoName: string;
|
|
19
|
+
dir: string;
|
|
20
|
+
branch: string | null;
|
|
21
|
+
dirty: number;
|
|
22
|
+
/** Commits ahead of the default branch; counted only where no branch would say. */
|
|
23
|
+
ahead: number;
|
|
24
|
+
touchedAt: number;
|
|
25
|
+
}
|
|
26
|
+
export interface IssueFact {
|
|
27
|
+
repoId: string;
|
|
28
|
+
repoName: string;
|
|
29
|
+
ref: string;
|
|
30
|
+
number: number;
|
|
31
|
+
url: string | null;
|
|
32
|
+
title: string;
|
|
33
|
+
body: string;
|
|
34
|
+
reporter: string | null;
|
|
35
|
+
}
|
|
36
|
+
export interface SessionFact {
|
|
37
|
+
agent: string;
|
|
38
|
+
agentTitle: string;
|
|
39
|
+
repoId: string;
|
|
40
|
+
repoName: string;
|
|
41
|
+
file: string;
|
|
42
|
+
at: number;
|
|
43
|
+
branch: string | null;
|
|
44
|
+
title: string;
|
|
45
|
+
lastSaid: string;
|
|
46
|
+
/** The conversation's end, what a model reads to judge it. */
|
|
47
|
+
excerpt: string;
|
|
48
|
+
}
|
|
49
|
+
/** Where the repository's default branch stands: the remote's when there is one. */
|
|
50
|
+
export declare function baseRef(git: Git, checkout: string, branch: string): Promise<string>;
|
|
51
|
+
/** Each branch's last commits, and which other unmerged branch it stands on: a stack is the one dependency git itself proves. */
|
|
52
|
+
export declare function readBranches(git: Git, checkout: string, base: string, branches: UnmergedBranch[]): Promise<BranchFact[]>;
|
|
53
|
+
/** Every worktree of the checkout but the checkout itself, by the folder git says it is in. */
|
|
54
|
+
export declare function worktreeFolders(git: Git, checkout: string): Promise<{
|
|
55
|
+
dir: string;
|
|
56
|
+
branch: string | null;
|
|
57
|
+
}[]>;
|
|
58
|
+
export declare function readWorktree(git: Git, repo: {
|
|
59
|
+
repoId: string;
|
|
60
|
+
repoName: string;
|
|
61
|
+
}, base: string, tree: {
|
|
62
|
+
dir: string;
|
|
63
|
+
branch: string | null;
|
|
64
|
+
}): Promise<WorktreeFact | null>;
|
|
65
|
+
/** What a session's record says: nothing is kept when no person ever spoke in it. */
|
|
66
|
+
export declare function readSession(record: EngineRecord, session: RecordSession, agent: {
|
|
67
|
+
id: string;
|
|
68
|
+
title: string;
|
|
69
|
+
}, repo: {
|
|
70
|
+
repoId: string;
|
|
71
|
+
repoName: string;
|
|
72
|
+
}): SessionFact | null;
|
|
73
|
+
/** Sessions a running agent may still be writing are nobody's unfinished work yet. */
|
|
74
|
+
export declare const quiet: (session: RecordSession, now: number) => boolean;
|
|
75
|
+
//# sourceMappingURL=facts.d.ts.map
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { Takeover, Takeover as default, type TakeoverApplied, type TakeoverDraft, type TakeoverOffer, type TakeoverScan } from "./service.js";
|
|
2
|
+
export { buildEntries, issueNumbers, markCovered, markSimilar, organize, ticketBody, type Facts, type TakeoverEntry, type TakeoverSource, type TakeoverSourceKind } from "./draft.js";
|
|
3
|
+
export { baseRef, readBranches, readSession, readWorktree, worktreeFolders, IDLE_MS, MAX_BRANCHES, type BranchFact, type IssueFact, type SessionFact, type WorktreeFact } from "./facts.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
throw new Error("@tomradex/takeover is Tomrade's own code: a full-mode plugin gets the running app's copy, so load the plugin in Tomrade");
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Context, Service } from "cordis";
|
|
2
|
+
import { type TakeoverEntry } from "./draft.js";
|
|
3
|
+
declare module "cordis" {
|
|
4
|
+
interface Context {
|
|
5
|
+
takeover: Takeover;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
declare module "@tomradex/ipc" {
|
|
9
|
+
interface Channels {
|
|
10
|
+
"takeover.offer": (projectId: string) => TakeoverOffer;
|
|
11
|
+
"takeover.scan": (projectId: string, input: TakeoverScan) => TakeoverDraft;
|
|
12
|
+
"takeover.apply": (projectId: string, draftId: string, entryIds: string[]) => TakeoverApplied;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/** What a person is told before anything is read or sent. */
|
|
16
|
+
export interface TakeoverOffer {
|
|
17
|
+
repos: {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
placed: boolean;
|
|
21
|
+
}[];
|
|
22
|
+
/** Whose records would be read, and from which folders. */
|
|
23
|
+
sessions: {
|
|
24
|
+
agent: string;
|
|
25
|
+
title: string;
|
|
26
|
+
folders: string[];
|
|
27
|
+
}[];
|
|
28
|
+
/** The model the draft would go to; null when none answers. */
|
|
29
|
+
model: string | null;
|
|
30
|
+
modelMissing: string | null;
|
|
31
|
+
}
|
|
32
|
+
export interface TakeoverScan {
|
|
33
|
+
/** The person agreed to the agents' records being read. */
|
|
34
|
+
sessions: boolean;
|
|
35
|
+
/** The model they agreed to send the draft to, by the name they were shown; null to send nothing. */
|
|
36
|
+
model: string | null;
|
|
37
|
+
}
|
|
38
|
+
export interface TakeoverDraft {
|
|
39
|
+
id: string;
|
|
40
|
+
projectId: string;
|
|
41
|
+
entries: TakeoverEntry[];
|
|
42
|
+
/** What the scan could not read or chose to leave out, in the person's language. */
|
|
43
|
+
notes: string[];
|
|
44
|
+
/** The model that organised it; null when only facts are listed. */
|
|
45
|
+
model: string | null;
|
|
46
|
+
}
|
|
47
|
+
export interface TakeoverApplied {
|
|
48
|
+
created: {
|
|
49
|
+
key: string;
|
|
50
|
+
title: string;
|
|
51
|
+
}[];
|
|
52
|
+
failed: {
|
|
53
|
+
title: string;
|
|
54
|
+
reason: string;
|
|
55
|
+
}[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Reads what a repository already holds into a draft backlog and writes only
|
|
59
|
+
* what a person ticks. A scan writes no ticket; the agents' records are read and
|
|
60
|
+
* anything is sent to a model only when the scan was told it may.
|
|
61
|
+
*/
|
|
62
|
+
export declare class Takeover extends Service {
|
|
63
|
+
static inject: string[];
|
|
64
|
+
private readonly home;
|
|
65
|
+
private readonly git;
|
|
66
|
+
/** The last draft per project: what a person ticks is what the scan found, not what a renderer sends back. */
|
|
67
|
+
private readonly drafts;
|
|
68
|
+
constructor(ctx: Context);
|
|
69
|
+
private words;
|
|
70
|
+
private llm;
|
|
71
|
+
/** Agents whose records can be listed by folder: their names and folders come from the agents themselves. */
|
|
72
|
+
private recorders;
|
|
73
|
+
offer(projectId: string): Promise<TakeoverOffer>;
|
|
74
|
+
scan(projectId: string, input: TakeoverScan): Promise<TakeoverDraft>;
|
|
75
|
+
private branches;
|
|
76
|
+
/** Worktrees nobody is using and no ticket holds. */
|
|
77
|
+
private worktrees;
|
|
78
|
+
/** Open issues, read directly: taking one through the inbox would answer on GitHub, which nobody asked here. */
|
|
79
|
+
private issues;
|
|
80
|
+
/** Runs only on the person's word: `scan` does not call it otherwise. */
|
|
81
|
+
private sessions;
|
|
82
|
+
/** Writes the ticked entries and nothing else. */
|
|
83
|
+
apply(projectId: string, draftId: string, entryIds: string[]): TakeoverApplied;
|
|
84
|
+
private create;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=service.d.ts.map
|
package/dist/words.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const TAKEOVER_WORDS: import("@tomradex/domain").WordBook<{
|
|
2
|
+
readonly sourceBranch: "Branch";
|
|
3
|
+
readonly sourceWorktree: "Worktree";
|
|
4
|
+
readonly sourceIssue: "Issue";
|
|
5
|
+
readonly sourceSession: "{{agent}} session";
|
|
6
|
+
readonly sourcesHeading: "Where this came from";
|
|
7
|
+
readonly branchDetail: "ahead of {{base}} by {{ahead}}, last commit {{date}}";
|
|
8
|
+
readonly branchSubjects: "recent commits: {{subjects}}";
|
|
9
|
+
readonly worktreeDirty: "uncommitted files: {{n}}";
|
|
10
|
+
readonly worktreeAhead: "commits on no branch: {{n}}";
|
|
11
|
+
readonly worktreeOn: "on {{branch}}";
|
|
12
|
+
readonly worktreeTouched: "last touched {{date}}";
|
|
13
|
+
readonly worktreeTitle: "Unfinished work in {{name}}";
|
|
14
|
+
readonly issueDetail: "opened by {{who}}";
|
|
15
|
+
readonly sessionDetail: "last active {{date}}";
|
|
16
|
+
readonly sessionSaid: "last said: {{text}}";
|
|
17
|
+
readonly sessionUnjudged: "No model has judged whether this session finished; read it before ticking.";
|
|
18
|
+
readonly noCheckout: "{{repo}} has no folder on this machine, so its branches and worktrees were not read.";
|
|
19
|
+
readonly offline: "Repositories that could not reach their remote: {{n}}. Their branches are as this machine last saw them.";
|
|
20
|
+
readonly tooManyBranches: "Only the {{n}} branches that moved last are listed.";
|
|
21
|
+
readonly noGithub: "GitHub is not connected, so issues were not read.";
|
|
22
|
+
readonly issuesFailed: "Issues of {{repo}} could not be read: {{why}}";
|
|
23
|
+
readonly sessionsDeclined: "Local agent sessions were not read.";
|
|
24
|
+
readonly noRecords: "No agent here keeps records Tomrade can read, so no session was read.";
|
|
25
|
+
readonly modelChanged: "The model is now {{now}}, not the {{asked}} you agreed to, so nothing was sent.";
|
|
26
|
+
readonly modelFailed: "The model could not organise the draft ({{why}}); this is what the scan found.";
|
|
27
|
+
readonly modelHid: "{{model}} judged these sessions finished and left them out: {{n}}.";
|
|
28
|
+
readonly stale: "This draft is out of date; scan again.";
|
|
29
|
+
}>;
|
|
30
|
+
export type TakeoverWords = ReturnType<typeof TAKEOVER_WORDS>;
|
|
31
|
+
//# sourceMappingURL=words.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomradex/takeover",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.27.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"author": "Haoyuan Tang",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=22"
|
|
8
|
+
},
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"license": "Apache-2.0",
|
|
13
|
+
"description": "Take over unfinished work: read a repository's unmerged branches, idle worktrees, GitHub issues and, with leave, local agent sessions into a draft backlog a person ticks — declarations for full-mode plugins; Tomrade provides the code at run time",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"tomrade",
|
|
16
|
+
"tomrade-plugin",
|
|
17
|
+
"types"
|
|
18
|
+
],
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"default": "./dist/runtime.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@tomradex/agent": "0.27.0",
|
|
31
|
+
"@tomradex/agent-backlog": "0.27.0",
|
|
32
|
+
"@tomradex/boards": "0.27.0",
|
|
33
|
+
"@tomradex/code-link": "0.27.0",
|
|
34
|
+
"@tomradex/contracts": "0.27.0",
|
|
35
|
+
"@tomradex/domain": "0.2.33",
|
|
36
|
+
"@tomradex/git": "0.27.0",
|
|
37
|
+
"@tomradex/github": "0.27.0",
|
|
38
|
+
"@tomradex/inbox": "0.27.0",
|
|
39
|
+
"@tomradex/inbox-github": "0.27.0",
|
|
40
|
+
"@tomradex/ipc": "0.27.0",
|
|
41
|
+
"@tomradex/items": "0.27.0",
|
|
42
|
+
"@tomradex/llm": "0.27.0",
|
|
43
|
+
"@tomradex/repos": "0.27.0",
|
|
44
|
+
"@tomradex/settings": "0.27.0",
|
|
45
|
+
"cordis": "4.0.0-rc.8",
|
|
46
|
+
"zod": "^4.4.3"
|
|
47
|
+
}
|
|
48
|
+
}
|
package/README.md
DELETED